-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix list selection when first node followed by an element node (#5583)
- Loading branch information
Showing
2 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...exical-playground/__tests__/regression/5583-select-list-followed-by-element-node.spec.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import { | ||
click, | ||
dragMouse, | ||
focusEditor, | ||
initialize, | ||
mouseMoveToSelector, | ||
selectFromInsertDropdown, | ||
selectorBoundingBox, | ||
test, | ||
waitForSelector, | ||
} from '../utils/index.mjs'; | ||
|
||
async function toggleBulletList(page) { | ||
await click(page, '.block-controls'); | ||
await click(page, '.dropdown .icon.bullet-list'); | ||
} | ||
test.describe('Regression test #5251', () => { | ||
test.beforeEach(({isCollab, page}) => initialize({isCollab, page})); | ||
test(`Element node in the middle of a bullet list and selecting doesn't crash`, async ({ | ||
page, | ||
isPlainText, | ||
}) => { | ||
test.skip(isPlainText); | ||
await focusEditor(page); | ||
|
||
page.on('console', (msg) => { | ||
if (msg.type() === 'error') { | ||
if ( | ||
msg.text().includes('error #68') || | ||
msg.text().includes('getNodesBetween: ancestor is null') | ||
) { | ||
test.fail(); | ||
} | ||
} | ||
}); | ||
|
||
await toggleBulletList(page); | ||
await page.keyboard.type('one'); | ||
await page.keyboard.press('Enter'); | ||
await page.keyboard.type('two'); | ||
await page.keyboard.press('Enter'); | ||
await selectFromInsertDropdown(page, '.horizontal-rule'); | ||
await waitForSelector(page, 'hr'); | ||
await page.keyboard.type('three'); | ||
await page.keyboard.press('Enter'); | ||
await mouseMoveToSelector(page, 'li:has-text("one")'); | ||
await page.mouse.down(); | ||
await dragMouse( | ||
page, | ||
await selectorBoundingBox(page, 'li:has-text("one")'), | ||
await selectorBoundingBox(page, 'li:has-text("three")'), | ||
'middle', | ||
'end', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters