From 49ab5d8b697ca04a900da1147d9be4b725178d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mog=C3=A8re?= Date: Fri, 5 Jul 2024 22:03:36 +0200 Subject: [PATCH] refactor: use composables --- .github/workflows/vitest.yml | 19 ++ .gitignore | 2 + app/components/ConfigDrawer.vue | 6 - app/components/StatusManager.vue | 31 +-- app/components/TreeNode.vue | 131 +++-------- app/components/ViewportSettings.vue | 4 +- app/composables/config.ts | 2 +- app/composables/node.ts | 39 ++++ app/composables/section.ts | 58 +++++ app/composables/status.ts | 60 +++++ app/composables/store.ts | 153 ++++--------- app/composables/style.ts | 52 +++++ {tests => e2e}/index.spec.ts | 6 +- nuxt.config.ts | 1 + package.json | 9 +- playwright.config.ts | 2 +- pnpm-lock.yaml | 214 ++++++++++++++++++ tests/composables/useNodeOperations.test.ts | 44 ++++ tests/composables/useNodeStyles.test.ts | 69 ++++++ .../composables/useSectionManagement.test.ts | 57 +++++ tests/composables/useStatusManagement.test.ts | 74 ++++++ tests/composables/useStore.test.ts | 146 ++++++++++++ 22 files changed, 933 insertions(+), 246 deletions(-) create mode 100644 .github/workflows/vitest.yml create mode 100644 app/composables/node.ts create mode 100644 app/composables/section.ts create mode 100644 app/composables/status.ts create mode 100644 app/composables/style.ts rename {tests => e2e}/index.spec.ts (97%) create mode 100644 tests/composables/useNodeOperations.test.ts create mode 100644 tests/composables/useNodeStyles.test.ts create mode 100644 tests/composables/useSectionManagement.test.ts create mode 100644 tests/composables/useStatusManagement.test.ts create mode 100644 tests/composables/useStore.test.ts diff --git a/.github/workflows/vitest.yml b/.github/workflows/vitest.yml new file mode 100644 index 0000000..0605d6d --- /dev/null +++ b/.github/workflows/vitest.yml @@ -0,0 +1,19 @@ +name: Vitest + +on: [push] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install -g pnpm && pnpm install + - name: test + run: | + pnpm test:coverage diff --git a/.gitignore b/.gitignore index 6b5a902..29cf1db 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ logs /playwright-report/ /blob-report/ /playwright/.cache/ +/coverage +/app/coverage \ No newline at end of file diff --git a/app/components/ConfigDrawer.vue b/app/components/ConfigDrawer.vue index 1fe5c9d..d46a3d2 100644 --- a/app/components/ConfigDrawer.vue +++ b/app/components/ConfigDrawer.vue @@ -221,10 +221,4 @@ onMounted(() => { display: flex; justify-content: flex-end; } -.status-item { - cursor: grab; -} -.status-item:active { - cursor: grabbing; -} diff --git a/app/components/StatusManager.vue b/app/components/StatusManager.vue index b9ac1a1..1d92ef7 100644 --- a/app/components/StatusManager.vue +++ b/app/components/StatusManager.vue @@ -1,28 +1,26 @@