Skip to content

Commit

Permalink
test: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey28 committed Oct 13, 2022
1 parent f30f2e8 commit 388c479
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/functional/fixtures/api/es-next/click/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<!--Click shifted element-->
<div id="shifted-element" style="background: green; width: 100px; height: 100px; transform: translateX(-60px);"></div>
<script>
document.querySelector('#shifted-element').addEventListener('click', function () {
document.querySelector('#shifted-element').addEventListener('click', function (e) {
const rect = document.querySelector('#shifted-element').getBoundingClientRect();

window.clickOffset = { x: e.pageX - rect.left, y: e.pageY - rect.top };
window.clickOffset = { x: e.pageX - Math.round(rect.left), y: e.pageY - Math.round(rect.top) };
});
</script>
<!--Click overlapped element-->
Expand All @@ -47,10 +47,10 @@
<div style="background: red; width: 60px; height: 60px; position: absolute;"></div>
</div>
<script>
document.querySelector('#overlapped-center').addEventListener('click', function () {
document.querySelector('#overlapped-center').addEventListener('click', function (e) {
const rect = document.querySelector('#overlapped-center').getBoundingClientRect();

window.clickOffset = { x: e.pageX - rect.left, y: e.pageY - rect.top };
window.clickOffset = { x: e.pageX - Math.round(rect.left), y: e.pageY - Math.round(rect.top) };
});
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test('Selector returns text node', async t => {
test('Click on a more than half-shifted element', async t => {
await t.click('#shifted-element');

const expectedClickOffset = { x: 75, y: 75 };
const expectedClickOffset = { x: 75, y: 25 };
const actualClickOffset = await getClickOffset();

expect(actualClickOffset.x).eql(expectedClickOffset.x);
Expand All @@ -97,7 +97,7 @@ test('Click on a more than half-shifted element', async t => {
test('Click on an element with overlapped center', async t => {
await t.click('#overlapped-center');

const expectedClickOffset = { x: 75, y: 75 };
const expectedClickOffset = { x: 75, y: 25 };
const actualClickOffset = await getClickOffset();

expect(actualClickOffset.x).eql(expectedClickOffset.x);
Expand Down

0 comments on commit 388c479

Please sign in to comment.