Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/core/src/editor/managers/StyleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ export class StyleManager<
const { from, to } = tr.selection;

if (text) {
tr.insertText(text, from, to).addMark(from, from + text.length, mark);
const existingText = tr.doc.textBetween(from, to);
if (text !== existingText) {
tr.insertText(text, from, to);
}

tr.addMark(from, from + text.length, mark);
} else {
tr.setSelection(TextSelection.create(tr.doc, to)).addMark(
from,
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/extensions/LinkToolbar/LinkToolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ export const LinkToolbarExtension = createExtension(({ editor }) => {
if (!range) {
return;
}
tr.insertText(text, range.from, range.to);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should actually probably use style manager.createLink here no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, since editLink takes an optional position whereas createLink always uses the selection start position to insert the link. This is necessary for hovered links, as the editor selection isn't related to the link position in this case.

We could ofc just update createLink to take an optional position/range, but because it's part of the editor API, I don't think we want to have anything related to ProseMirror positions there. Ideally this would be solved when we finish our own locations API.

const existingText = tr.doc.textBetween(range.from, range.to);
if (text !== existingText) {
tr.insertText(text, range.from, range.to);
}

tr.addMark(
range.from,
range.from + text.length,
Expand Down
50 changes: 50 additions & 0 deletions tests/src/end-to-end/linktoolbar/linktoolbar.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { expect } from "@playwright/test";
import { test } from "../../setup/setupScript.js";
import { BASE_URL, LINK_BUTTON_SELECTOR } from "../../utils/const.js";
import { focusOnEditor } from "../../utils/editor.js";

test.beforeEach(async ({ page }) => {
await page.goto(BASE_URL);
});

test.describe("Check Link Toolbar functionality", () => {
test("Should preserve existing marks when editing a link", async ({
page,
}) => {
await focusOnEditor(page);

// Type bold text
await page.keyboard.type("hello");
await page.keyboard.press("Shift+Home");

// Make it bold via formatting toolbar
await page.waitForSelector(`[data-test="bold"]`);
await page.click(`[data-test="bold"]`);

// Add link
await page.keyboard.press("Shift+Home");
await page.waitForSelector(LINK_BUTTON_SELECTOR);
await page.click(LINK_BUTTON_SELECTOR);
await page.keyboard.type("https://example.com");
await page.keyboard.press("Enter");

// Move cursor back onto the linked text to trigger link toolbar
await page.keyboard.press("ArrowLeft");
await page.waitForTimeout(500);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and read the test file
find . -name "linktoolbar.test.ts" -type f

Repository: TypeCellOS/BlockNote

Length of output: 118


🏁 Script executed:

# Read the test file to see lines around 33 and 44
cat -n tests/src/end-to-end/linktoolbar/linktoolbar.test.ts | head -60

Repository: TypeCellOS/BlockNote

Length of output: 2041


Replace hard timeouts with state-based waits

Line 33 and Line 44 use page.waitForTimeout(), which can make this E2E test flaky and is deprecated in modern Playwright. Line 33 waits before the subsequent state-based waitFor() on line 37, and line 44 waits before the assertion on line 48—both of which include built-in retry logic. Remove the hard timeouts and let the state-based waits handle synchronization.

Suggested change
    // Move cursor back onto the linked text to trigger link toolbar
    await page.keyboard.press("ArrowLeft");
-   await page.waitForTimeout(500);

    // Click Edit link button
    const editButton = page.getByText("Edit link");
    await editButton.waitFor({ state: "visible" });
    await page.keyboard.press("Enter");

-   await page.waitForTimeout(300);

    // Verify bold mark is still present on the text
    const boldText = page.locator("strong a, a strong");
    await expect(boldText).toBeVisible();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/src/end-to-end/linktoolbar/linktoolbar.test.ts` at line 33, Remove the
two hard-coded delays by deleting the await page.waitForTimeout(...) calls and
rely on the existing state-based waits; specifically, remove the
page.waitForTimeout before the subsequent await page.waitFor(...) call and the
page.waitForTimeout before the assertion, and ensure the assertions use
Playwright's built-in retryable checks (e.g., await page.waitForSelector(...) or
await expect(locator).toBeVisible()/toHaveText(...)) so synchronization is
driven by element state rather than fixed timeouts.


// Click Edit link button
const editButton = page.getByText("Edit link");
await editButton.waitFor({ state: "visible" });

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - firefox (2/2)

[firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [firefox] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - chromium (2/2)

[chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [chromium] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22

Check failure on line 37 in tests/src/end-to-end/linktoolbar/linktoolbar.test.ts

View workflow job for this annotation

GitHub Actions / Playwright Tests - webkit (2/2)

[webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link

1) [webkit] › src/end-to-end/linktoolbar/linktoolbar.test.ts:11:7 › Check Link Toolbar functionality › Should preserve existing marks when editing a link Error: locator.waitFor: Test timeout of 30000ms exceeded. Call log: - waiting for getByText('Edit link') to be visible 35 | // Click Edit link button 36 | const editButton = page.getByText("Edit link"); > 37 | await editButton.waitFor({ state: "visible" }); | ^ 38 | await editButton.click(); 39 | 40 | await page.keyboard.press("Control+A"); at /__w/BlockNote/BlockNote/tests/src/end-to-end/linktoolbar/linktoolbar.test.ts:37:22
await editButton.click();

await page.keyboard.press("Control+A");
await page.keyboard.type("https://example2.com");
await page.keyboard.press("Enter");

await page.waitForTimeout(300);

// Verify bold mark is still present on the text
const boldText = page.locator("strong a, a strong");
await expect(boldText).toBeVisible();
Comment on lines +46 to +48
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n tests/src/end-to-end/linktoolbar/linktoolbar.test.ts | head -100

Repository: TypeCellOS/BlockNote

Length of output: 2041


Assertion validates only bold preservation, not the link edit itself

The current assertion only verifies that bold formatting is preserved. The test name promises to validate that marks are preserved "when editing a link," but there's no check that the href was actually updated to example2.com. The assertion will pass even if the link edit silently fails.

Include the expected href in the selector to ensure the edit-link behavior is actually working:

Suggested change
-    const boldText = page.locator("strong a, a strong");
-    await expect(boldText).toBeVisible();
+    const boldEditedLink = page.locator(
+      'strong a[href*="example2.com"], a[href*="example2.com"] strong',
+    );
+    await expect(boldEditedLink).toBeVisible();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Verify bold mark is still present on the text
const boldText = page.locator("strong a, a strong");
await expect(boldText).toBeVisible();
// Verify bold mark is still present on the text
const boldEditedLink = page.locator(
'strong a[href*="example2.com"], a[href*="example2.com"] strong',
);
await expect(boldEditedLink).toBeVisible();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/src/end-to-end/linktoolbar/linktoolbar.test.ts` around lines 46 - 48,
The test currently only checks bold preservation via the locator boldText
("strong a, a strong") but does not assert that the link edit updated the href
to "example2.com"; update the assertion to include the expected href (e.g.,
change the locator to target an anchor with href="https://example2.com" or
include [href*="example2.com"] alongside the existing strong selectors) so the
test validates both bold mark preservation and that the link's href was actually
changed after edit.

});
});
Loading