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.
Should find element with not-integer offset (closes DevExpress#2080)
- Loading branch information
1 parent
5522e04
commit ef5c8b6
Showing
5 changed files
with
128 additions
and
23 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
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
83 changes: 83 additions & 0 deletions
83
test/functional/fixtures/regression/gh-2080/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,83 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
<style> | ||
#parent { | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
margin: 100px; | ||
position: relative; | ||
} | ||
|
||
.child { | ||
width: 10px; | ||
height: 10px; | ||
background-color: blue; | ||
position: absolute; | ||
} | ||
|
||
#child1 { | ||
top: 5.1px; | ||
left: 5.1px; | ||
} | ||
|
||
#child2 { | ||
top: 25.3px; | ||
left: 25.3px; | ||
} | ||
|
||
#child3 { | ||
top: 45.5px; | ||
left: 45.5px; | ||
} | ||
|
||
#child4 { | ||
top: 65.7px; | ||
left: 65.7px; | ||
} | ||
|
||
.leaf { | ||
width: 1px; | ||
height: 1px; | ||
background-color: white; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="parent"> | ||
<div id="child1" class="child"> | ||
<div id="leaf1" class="leaf"></div> | ||
</div> | ||
|
||
<div id="child2" class="child"> | ||
<div id="leaf2" class="leaf"></div> | ||
</div> | ||
|
||
<div id="child3" class="child"> | ||
<div id="leaf3" class="leaf"></div> | ||
</div> | ||
|
||
<div id="child4" class="child"> | ||
<div id="leaf4" class="leaf"></div> | ||
</div> | ||
</div> | ||
|
||
<div id="result"></div> | ||
<script> | ||
function log(e) { | ||
document.querySelector('#result').innerHTML += e.currentTarget.id + ' '; | ||
} | ||
|
||
var divs = document.querySelectorAll('div'); | ||
|
||
for (var i = 0; i < divs.length; i++) | ||
divs[i].addEventListener('click', log); | ||
</script> | ||
</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-2080)', function () { | ||
it('Should find element with not-integer offset', function () { | ||
return runTests('testcafe-fixtures/index.js'); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
test/functional/fixtures/regression/gh-2080/testcafe-fixtures/index.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,15 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
fixture `GH-2080 - Should find element with not-integer offset` | ||
.page `http://localhost:3000/fixtures/regression/gh-2080/pages/index.html`; | ||
|
||
const result = Selector('#result'); | ||
|
||
test('Click on elements with not-integer offsets', async t => { | ||
await t | ||
.click('#child1', { offsetX: 0, offsetY: 0 }) | ||
.click('#child2', { offsetX: 0, offsetY: 0 }) | ||
.click('#child3', { offsetX: 0, offsetY: 0 }) | ||
.click('#child4', { offsetX: 0, offsetY: 0 }) | ||
.expect(result.innerText).contains('leaf1 child1 parent leaf2 child2 parent leaf3 child3 parent leaf4 child4 parent'); | ||
}); |