|
| 1 | +import { test, expect } from "@playwright/test"; |
| 2 | +import App from "../support/app"; |
| 3 | + |
| 4 | +const OPTIONS_TITLE = "Options"; |
| 5 | +const NOTE_TITLE = "Tree Operations" |
| 6 | + |
| 7 | +test("Hoist note remains expanded when opening Options and clicking child note", async ({ page, context }) => { |
| 8 | + const app = new App(page, context); |
| 9 | + await app.goto(); |
| 10 | + await app.closeAllTabs(); |
| 11 | + |
| 12 | + await app.goToSettings(); |
| 13 | + |
| 14 | + // Activate it when opening Options |
| 15 | + await expect(app.noteTreeActiveNote).toContainText(OPTIONS_TITLE); |
| 16 | + |
| 17 | + // Clicking a hoist’s child note does not collapse the hoist note |
| 18 | + await app.clickNoteOnNoteTreeByTitle("Appearance"); |
| 19 | + const node = app.page.locator(".fancytree-node.fancytree-submatch:has(.bx-cog)"); |
| 20 | + await expect(node).toHaveClass(/fancytree-expanded/); |
| 21 | +}); |
| 22 | + |
| 23 | +test("Activate it when hoisting a note", async ({ page, context }) => { |
| 24 | + const app = new App(page, context); |
| 25 | + await app.goto(); |
| 26 | + await app.closeAllTabs(); |
| 27 | + |
| 28 | + const treeNode = app.noteTree.getByText(NOTE_TITLE); |
| 29 | + await treeNode.click({ button: "right" }); |
| 30 | + const hoistMenuItem = page.locator( |
| 31 | + '#context-menu-container .dropdown-item span', |
| 32 | + { hasText: "Hoist note" } |
| 33 | + ); |
| 34 | + await hoistMenuItem.click(); |
| 35 | + await expect(app.noteTreeActiveNote).toContainText(NOTE_TITLE); |
| 36 | + await app.page.locator(".unhoist-button").click(); |
| 37 | + await expect(app.noteTreeActiveNote).toContainText(NOTE_TITLE); |
| 38 | +}); |
0 commit comments