forked from DevExpress/testcafe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed focus for click automation (closes DevExpress#913)
- Loading branch information
Georgiy Abbasov
committed
Oct 24, 2016
1 parent
fc41d4b
commit 255b776
Showing
4 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
test/functional/fixtures/regression/gh-913/pages/index.html
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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>GH-913</title> | ||
</head> | ||
<body> | ||
<div id="parent" style="width:500px; height:2000px; top:200px; position:absolute; background:grey;" tabindex="0"> | ||
<div id="child" style="width:100px; height:100px; top:100px; position:absolute; background:red;"></div> | ||
</div> | ||
</body> | ||
</html> |
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,5 @@ | ||
describe('[Regression](GH-913)', function () { | ||
it("Shouldn't scroll to the focusable parent while performing click on non-focusable element", function () { | ||
return runTests('testcafe-fixtures/index-test.js', "Shouldn't scroll to target parent while performing click"); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
test/functional/fixtures/regression/gh-913/testcafe-fixtures/index-test.js
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,17 @@ | ||
import { expect } from 'chai'; | ||
import { ClientFunction } from 'testcafe'; | ||
|
||
fixture `gh-913` | ||
.page `http://localhost:3000/fixtures/regression/gh-913/pages/index.html`; | ||
|
||
const getWindowScrollTop = ClientFunction(() => window.pageYOffset); | ||
|
||
test("Shouldn't scroll to target parent while performing click", async t => { | ||
const oldWindowScrollValue = await getWindowScrollTop(); | ||
|
||
await t.click('#child'); | ||
|
||
const newWindowScrollValue = await getWindowScrollTop(); | ||
|
||
expect(newWindowScrollValue).eql(oldWindowScrollValue); | ||
}); |