Skip to content

Commit

Permalink
Add test for multiple leading "#" characters in a hashtag (#5723)
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh authored Mar 17, 2024
1 parent 76fc0c3 commit 058f55a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/lexical-playground/__tests__/e2e/Hashtags.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,47 @@ test.describe('Hashtags', () => {
`,
);
});

test('Should not break with multiple leading "#" #5636', async ({page}) => {
await focusEditor(page);
await page.keyboard.type('#hello');

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>
</p>
`,
);
await assertSelection(page, {
anchorOffset: 6,
anchorPath: [0, 0, 0],
focusOffset: 6,
focusPath: [0, 0, 0],
});

await moveToEditorBeginning(page);
await page.keyboard.type('#');

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

0 comments on commit 058f55a

Please sign in to comment.