Skip to content

Commit d2c866e

Browse files
committed
fix broekn tests
1 parent ad05bbe commit d2c866e

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

packages/lexical-playground/__tests__/regression/2648-triple-click.spec.mjs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
import {
1010
assertHTML,
11-
assertSelection,
1211
click,
12+
expect,
1313
focusEditor,
14+
getEditorElement,
1415
html,
1516
initialize,
1617
test,
@@ -129,23 +130,13 @@ test.describe.parallel('Regression test #2648', () => {
129130
</p>
130131
`;
131132

132-
const firstLineSelection = {
133-
anchorOffset: 0,
134-
anchorPath: [0, 0, 0],
135-
focusOffset: 12,
136-
focusPath: [0, 0, 0],
137-
};
138-
139-
const secondLineSelection = {
140-
anchorOffset: 0,
141-
anchorPath: [1, 0, 0],
142-
focusOffset: 12,
143-
focusPath: [1, 0, 0],
144-
};
145-
146133
//format and check the first line
147134
await click(page, firstLine, {clickCount: 4}); // Note: the issue sometimes shows up on triple click but the 4th click seems to be a more reliable way to replicate it
148-
await assertSelection(page, firstLineSelection);
135+
expect(
136+
await getEditorElement(page).evaluate(() =>
137+
window.getSelection()?.toString(),
138+
),
139+
).toBe('line of text');
149140
await click(page, dropDownSelector);
150141
await click(page, formatSelector);
151142
await assertHTML(
@@ -159,7 +150,11 @@ test.describe.parallel('Regression test #2648', () => {
159150

160151
// format and test the middle line
161152
await click(page, secondLine, {clickCount: 4});
162-
await assertSelection(page, secondLineSelection);
153+
expect(
154+
await getEditorElement(page).evaluate(() =>
155+
window.getSelection()?.toString(),
156+
),
157+
).toBe('line of text');
163158
await click(page, dropDownSelector);
164159
await click(page, formatSelector);
165160
await assertHTML(

0 commit comments

Comments
 (0)