mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-02 23:27:28 +03:00
chore: clear highlight when performing action (#33638)
This commit is contained in:
parent
a98021499f
commit
46321e5bf2
@ -492,9 +492,10 @@ class RecordActionTool implements RecorderTool {
|
|||||||
return;
|
return;
|
||||||
const result = activeElement ? this._recorder.injectedScript.generateSelector(activeElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null;
|
const result = activeElement ? this._recorder.injectedScript.generateSelector(activeElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null;
|
||||||
this._activeModel = result && result.selector ? result : null;
|
this._activeModel = result && result.selector ? result : null;
|
||||||
if (userGesture)
|
if (userGesture) {
|
||||||
this._hoveredElement = activeElement as HTMLElement | null;
|
this._hoveredElement = activeElement as HTMLElement | null;
|
||||||
this._updateModelForHoveredElement();
|
this._updateModelForHoveredElement();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _shouldIgnoreMouseEvent(event: MouseEvent): boolean {
|
private _shouldIgnoreMouseEvent(event: MouseEvent): boolean {
|
||||||
@ -589,6 +590,8 @@ class RecordActionTool implements RecorderTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _updateModelForHoveredElement() {
|
private _updateModelForHoveredElement() {
|
||||||
|
if (this._performingActions.size)
|
||||||
|
return;
|
||||||
if (!this._hoveredElement || !this._hoveredElement.isConnected) {
|
if (!this._hoveredElement || !this._hoveredElement.isConnected) {
|
||||||
this._hoveredModel = null;
|
this._hoveredModel = null;
|
||||||
this._hoveredElement = null;
|
this._hoveredElement = null;
|
||||||
|
@ -402,17 +402,6 @@ await page1.GotoAsync("about:blank?foo");`);
|
|||||||
await expect.poll(() => messages).toEqual(['mousedown', 'mouseup', 'click']);
|
await expect.poll(() => messages).toEqual(['mousedown', 'mouseup', 'click']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should update hover model on action', async ({ openRecorder }) => {
|
|
||||||
const { page, recorder } = await openRecorder();
|
|
||||||
|
|
||||||
await recorder.setContentAndWait(`<input id="checkbox" type="checkbox" name="accept" onchange="checkbox.name='updated'"></input>`);
|
|
||||||
const [models] = await Promise.all([
|
|
||||||
recorder.waitForActionPerformed(),
|
|
||||||
page.click('input')
|
|
||||||
]);
|
|
||||||
expect(models.hovered).toBe('#checkbox');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should reset hover model on action when element detaches', async ({ openRecorder }) => {
|
test('should reset hover model on action when element detaches', async ({ openRecorder }) => {
|
||||||
const { page, recorder } = await openRecorder();
|
const { page, recorder } = await openRecorder();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user