Skip to content

Commit

Permalink
Merge branch 'master' into ghp-526
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelMor25 authored Nov 21, 2024
2 parents 8861516 + ef60584 commit e58682f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client/automation/playback/drag/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class DragAutomationBase extends VisibleElementAutomation {
});
}

_mouseup () {
_mouseup (draggedElement) {
return cursor
.buttonUp()
.then(() => {
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class DragAutomationBase extends VisibleElementAutomation {
})
.then(element => {
//B231323
if (topElement && element === topElement && !this.dragAndDropState.enabled)
if (topElement && element === topElement && !this.dragAndDropState.enabled && element === draggedElement)
eventSimulator.click(topElement, options);
});
});
Expand All @@ -152,6 +152,6 @@ export default class DragAutomationBase extends VisibleElementAutomation {
return Promise.all([delay(this.automationSettings.mouseActionStepDelay), this._mousedown(eventArgs)]);
})
.then(() => this._drag())
.then(() => this._mouseup());
.then(() => this._mouseup(eventArgs.element));
}
}
11 changes: 11 additions & 0 deletions test/functional/fixtures/regression/gh-8250/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>gh-8250</title>
</head>
<body>
<h1>Example</h1>
<input id="example" type="radio" />
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-8250/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-8250)', function () {
it('Click should not be called after dragToElement', function () {
return runTests('testcafe-fixtures/index.js', 'Click should not be called', { only: 'chrome' });
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Selector } from 'testcafe';

fixture('GH-8250- Click should not be called after dragToElement')
.page`http://localhost:3000/fixtures/regression/gh-8250/pages/index.html`;

test('Click should not be called', async t => {
const h1Label = Selector('h1').withText('Example');
const radioInput = Selector('#example');

await t.dragToElement(h1Label, radioInput);
await t.expect(radioInput.checked).eql(false);
});

0 comments on commit e58682f

Please sign in to comment.