mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
fix(codegen): ignore previously hovered detached nodes (#23057)
Fixes #23043.
This commit is contained in:
parent
2fc6341841
commit
62146b946c
@ -249,8 +249,9 @@ export class Recorder {
|
||||
}
|
||||
|
||||
private _updateModelForHoveredElement() {
|
||||
if (!this._hoveredElement) {
|
||||
if (!this._hoveredElement || !this._hoveredElement.isConnected) {
|
||||
this._hoveredModel = null;
|
||||
this._hoveredElement = null;
|
||||
this._updateHighlight();
|
||||
return;
|
||||
}
|
||||
|
@ -439,6 +439,17 @@ test.describe('cli codegen', () => {
|
||||
expect(models.hovered).toBe('#checkbox');
|
||||
});
|
||||
|
||||
test('should reset hover model on action when element detaches', async ({ page, openRecorder }) => {
|
||||
const recorder = await openRecorder();
|
||||
|
||||
await recorder.setContentAndWait(`<input id="checkbox" onclick="document.getElementById('checkbox').remove()">`);
|
||||
const [models] = await Promise.all([
|
||||
recorder.waitForActionPerformed(),
|
||||
page.click('input')
|
||||
]);
|
||||
expect(models.hovered).toBe(null);
|
||||
});
|
||||
|
||||
test('should update active model on action', async ({ page, openRecorder, browserName, headless }) => {
|
||||
test.fixme(browserName === 'webkit');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user