Skip to content

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 8, 2024
1 parent cac6882 commit bf6448e
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions packages/lexical-playground/__tests__/e2e/Hashtags.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import {
assertHTML,
assertSelection,
click,
focusEditor,
html,
initialize,
Expand Down Expand Up @@ -442,18 +443,41 @@ test.describe('Hashtags', () => {
);
});

test('Should not break with multiple matches', async ({
test('Should not break when pasting multiple matches', async ({
page,
isPlainText,
}) => {
test.skip(isPlainText);

await focusEditor(page);

const clipboard = {'text/html': '#hello#world#more#next#matches'};
const clipboard = {'text/html': '#hello#world'};
await pasteFromClipboard(page, clipboard);

await waitForSelector(page, '.PlaygroundEditorTheme__hashtag');
await assertHTML(
page,
html`
<p
class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
dir="ltr">
<span class="PlaygroundEditorTheme__hashtag" data-lexical-text="true">
#hello
</span>
<span data-lexical-text="true">#world</span>
</p>
`,
);
});

test('Should not break while importing and exporting multiple matches', async ({
page,
}) => {
await focusEditor(page);
await page.keyboard.type('```markdown #hello#invalid #a #b');

await click(page, '.action-button .markdown');
await click(page, '.action-button .markdown');
await click(page, '.action-button .markdown');

await assertHTML(
page,
Expand All @@ -464,7 +488,14 @@ test.describe('Hashtags', () => {
<span class="PlaygroundEditorTheme__hashtag" data-lexical-text="true">
#hello
</span>
<span data-lexical-text="true">#world#more#next#matches</span>
<span data-lexical-text="true">#invalid</span>
<span class="PlaygroundEditorTheme__hashtag" data-lexical-text="true">
#a
</span>
<span data-lexical-text="true"></span>
<span class="PlaygroundEditorTheme__hashtag" data-lexical-text="true">
#b
</span>
</p>
`,
);
Expand Down

0 comments on commit bf6448e

Please sign in to comment.