import { describe, expect, test } from "@odoo/hoot"; import { setupEditor, testEditor } from "../_helpers/editor"; import { cleanLinkArtifacts, unformat } from "../_helpers/format"; import { animationFrame, click, select, waitFor, waitForNone } from "@odoo/hoot-dom"; import { getContent, simulateDoubleClickSelect } from "../_helpers/selection"; import { insertText } from "../_helpers/user_actions"; import { contains } from "@web/../tests/web_test_helpers"; describe("button style", () => { test("editable button should have cursor text", async () => { const { el } = await setupEditor( '
' ); const button = el.querySelector("a"); expect(button).toHaveStyle({ cursor: "text" }); }); test("non-editable .btn-link should have cursor pointer", async () => { const { el } = await setupEditor( // A simpliflied version of an embedded component with toolbar // buttons, as it happens in certain flows in Knowledge. unformat(`this is a link
'); await waitForNone(".o-we-linkpopover"); const button = el.querySelector("a"); // simulate double click selection await simulateDoubleClickSelect(button); expect(getContent(el)).toBe( 'this is a \ufeff[\ufefflink]\ufeff\ufeff
' ); expect(cleanLinkArtifacts(getContent(el))).toBe('this is a [link]
'); await insertText(editor, "X"); expect(cleanLinkArtifacts(getContent(el))).toBe('this is a X[]
'); }); });