Skip to content

Commit 3e11211

Browse files
committed
test(mdviewer): verify CM source after link popover edit and remove
Add awaitsFor checks to confirm the CodeMirror source reflects the edited URL and removed link markdown after popover interactions.
1 parent be410ef commit 3e11211

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/spec/md-editor-integ-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,14 @@ define(function (require, exports, module) {
13871387
// Old URL should be gone
13881388
expect(content.querySelector("a[href*='test-link-doc2']")).toBeNull();
13891389

1390+
// Verify CM source has the edited URL
1391+
const editor = EditorManager.getActiveEditor();
1392+
await awaitsFor(() => {
1393+
const cmVal = editor._codeMirror.getValue();
1394+
return cmVal.includes("https://edited-popover.example.com") &&
1395+
!cmVal.includes("test-link-doc2.example.com");
1396+
}, "CM source to contain edited URL and not old URL");
1397+
13901398
// Force close without saving
13911399
await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE, { _forceClose: true }),
13921400
"force close doc2.md");
@@ -1423,6 +1431,14 @@ define(function (require, exports, module) {
14231431

14241432
expect(content.textContent).toContain("Remove Link");
14251433

1434+
// Verify CM source has link text but no markdown link syntax
1435+
const editor = EditorManager.getActiveEditor();
1436+
await awaitsFor(() => {
1437+
const cmVal = editor._codeMirror.getValue();
1438+
return cmVal.includes("Remove Link") &&
1439+
!cmVal.includes("[Remove Link](https://remove-link-doc3.example.com)");
1440+
}, "CM source to have plain text without link markdown");
1441+
14261442
// Force close without saving
14271443
await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE, { _forceClose: true }),
14281444
"force close doc3.md");

0 commit comments

Comments
 (0)