Skip to content

Commit

Permalink
fix: fixed test due to change in autoIdentifyLink behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushAgrawal-A2 committed Nov 20, 2023
1 parent fe297bb commit bae9620
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
5 changes: 4 additions & 1 deletion tests/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ test(scoped`automatic identify url text`, async ({ page }) => {
await enterPlaygroundRoom(page);
await initEmptyParagraphState(page);
await focusRichText(page);
await type(page, 'abc https://google.com');
await type(page, 'abc https://google.com ');

await assertStoreMatchJSX(
page,
Expand All @@ -525,6 +525,9 @@ test(scoped`automatic identify url text`, async ({ page }) => {
insert="https://google.com"
link="https://google.com"
/>
<text
insert=" "
/>
</>
}
prop:type="text"
Expand Down
16 changes: 11 additions & 5 deletions tests/bookmark.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ test(scoped`copy url to create bookmark in page mode`, async ({ page }) => {
await initEmptyParagraphState(page);
await focusRichText(page);

await type(page, 'https://google.com');
await type(page, 'https://google.com ');
await setVRangeInSelectedRichText(page, 0, 18);
await copyByKeyboard(page);
await focusRichText(page);
Expand All @@ -164,7 +164,10 @@ test(scoped`copy url to create bookmark in page mode`, async ({ page }) => {
<>
<text
insert="https://google.com"
link="https://google.com/bookmark"
link="https://google.com"
/>
<text
insert=" "
/>
</>
}
Expand All @@ -189,7 +192,7 @@ test(scoped`copy url to create bookmark in edgeless mode`, async ({ page }) => {
await enterPlaygroundRoom(page);
const ids = await initEmptyEdgelessState(page);
await focusRichText(page);
await type(page, 'https://google.com');
await type(page, 'https://google.com ');

await switchEditorMode(page);

Expand Down Expand Up @@ -217,7 +220,10 @@ test(scoped`copy url to create bookmark in edgeless mode`, async ({ page }) => {
<>
<text
insert="https://google.com"
link="https://google.com/bookmark"
link="https://google.com"
/>
<text
insert=" "
/>
</>
}
Expand All @@ -231,7 +237,7 @@ test(scoped`copy url to create bookmark in edgeless mode`, async ({ page }) => {
prop:icon=""
prop:image=""
prop:type="card"
prop:url="https://google.com"
prop:url="https://google.com "
/>
</affine:note>
</affine:page>`
Expand Down
33 changes: 0 additions & 33 deletions tests/link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,39 +131,6 @@ async function createLinkBlock(page: Page, str: string, link: string) {
return id;
}

test('text added after a link which has custom edited should not have link formatting', async ({
page,
}) => {
await enterPlaygroundRoom(page);
const id = await createLinkBlock(page, 'link text', 'http://example.com');
await focusRichText(page, 0);
await type(page, 'after link');
await assertStoreMatchJSX(
page,
// XXX This snapshot is not exactly correct, but it's close enough for now.
// The first text after the link should not have the link formatting.
`
<affine:paragraph
prop:text={
<>
<text
insert="Hello"
/>
<text
insert="link text"
link="http://example.com"
/>
<text
insert="after link"
/>
</>
}
prop:type="text"
/>`,
id
);
});

test('type character in link should not jump out link node', async ({
page,
}) => {
Expand Down

0 comments on commit bae9620

Please sign in to comment.