Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhankerism committed May 9, 2024
1 parent 83ad130 commit 0f7243f
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions packages/lexical-playground/__tests__/e2e/AutoLinks.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,55 @@ test.describe('Auto Links', () => {
{ignoreClasses: true},
);
});

test('Can convert url-like text with styles into links', async ({
page,
isPlainText,
}) => {
test.skip(isPlainText);
await focusEditor(page);

//increase font size
await click(page, '.font-increment');
await click(page, '.font-increment');

await page.keyboard.type('Hellohttp://example.com and more');

await assertHTML(
page,
html`
<p dir="ltr">
<span style="font-size: 19px;" data-lexical-text="true">
Hellohttp://example.com and more
</span>
</p>
`,
undefined,
{ignoreClasses: true},
);

// Add space before link text
await moveToLineBeginning(page);
await moveRight(page, 5);
await page.keyboard.type(' ');

await assertHTML(
page,
html`
<p dir="ltr">
<span style="font-size: 19px;" data-lexical-text="true">Hello</span>
<a href="http://example.com" dir="ltr">
<span style="font-size: 19px;" data-lexical-text="true">
http://example.com
</span>
</a>
<span style="font-size: 19px;" data-lexical-text="true">
and more
</span>
</p>
`,
undefined,
{ignoreClasses: true},
);
});
});

0 comments on commit 0f7243f

Please sign in to comment.