diff --git a/frontend/package.json b/frontend/package.json index 848dc12..c323ad8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,5 +29,10 @@ "tailwindcss": "^3.4.0", "vite": "^6.4.3", "vitest": "^4.1.7" + }, + "allowScripts": { + "esbuild@0.25.12": true, + "vue-demi@0.14.10": true, + "fsevents@2.3.3": true } } diff --git a/frontend/src/components/folders/FolderRow.vue b/frontend/src/components/folders/FolderRow.vue deleted file mode 100644 index dc39271..0000000 --- a/frontend/src/components/folders/FolderRow.vue +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - {{ renameError }} - - - - {{ folder.name }} - {{ folder.doc_count ?? 0 }} document{{ (folder.doc_count ?? 0) !== 1 ? 's' : '' }} - - - - - - - - - - - - - - - - Rename - - - Delete folder - - - - - - diff --git a/frontend/src/components/ui/__tests__/dropdown.test.js b/frontend/src/components/ui/__tests__/dropdown.test.js index 9e8078f..e02bd6c 100644 --- a/frontend/src/components/ui/__tests__/dropdown.test.js +++ b/frontend/src/components/ui/__tests__/dropdown.test.js @@ -1,9 +1,8 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest' -import { mount, flushPromises } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import { createPinia, setActivePinia } from 'pinia' import { nextTick } from 'vue' import DocumentCard from '../../documents/DocumentCard.vue' -import FolderRow from '../../folders/FolderRow.vue' // ── Stubs ────────────────────────────────────────────────────────────────────── @@ -24,12 +23,6 @@ const SAMPLE_DOC = { is_shared: false, } -const SAMPLE_FOLDER = { - id: 'folder-1', - name: 'Archive', - doc_count: 5, -} - describe('UX-13: Teleport + getBoundingClientRect dropdown pattern across components', () => { beforeEach(() => { setActivePinia(createPinia()) @@ -96,59 +89,4 @@ describe('UX-13: Teleport + getBoundingClientRect dropdown pattern across compon wrapper.unmount() }) - - it('FolderRow three-dot menu uses Teleport to body', async () => { - const wrapper = mount(FolderRow, { - props: { folder: SAMPLE_FOLDER }, - attachTo: document.body, - }) - - const menuBtn = wrapper.find('[aria-label="Folder actions"]') - expect(menuBtn.exists()).toBe(true) - await menuBtn.trigger('click') - await nextTick() - - // The menu should be teleported to body - const menu = document.body.querySelector('[data-test="folder-row-menu"]') - expect(menu).not.toBeNull() - - wrapper.unmount() - }) - - it('FolderRow three-dot menu repositions on window scroll', async () => { - const wrapper = mount(FolderRow, { - props: { folder: SAMPLE_FOLDER }, - attachTo: document.body, - }) - - const menuBtn = wrapper.find('[aria-label="Folder actions"]') - await menuBtn.trigger('click') - await nextTick() - - const menu = document.body.querySelector('[data-test="folder-row-menu"]') - expect(menu).not.toBeNull() - const initialTop = menu.style.top || menu.style.bottom - - // Change what getBoundingClientRect returns (simulate scroll) - vi.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ - top: 200, - bottom: 240, - left: 50, - right: 250, - width: 200, - height: 40, - x: 50, - y: 200, - }) - - // Dispatch scroll event - window.dispatchEvent(new Event('scroll', { bubbles: true })) - await nextTick() - - const updatedTop = menu.style.top || menu.style.bottom - // Position should have updated (top changed from 140+4 to 240+4) - expect(updatedTop).not.toBe(initialTop) - - wrapper.unmount() - }) })
{{ renameError }}
{{ folder.name }}
{{ folder.doc_count ?? 0 }} document{{ (folder.doc_count ?? 0) !== 1 ? 's' : '' }}