Skip to content

Commit

Permalink
fix: typeText should work with the DX Lookup search field
Browse files Browse the repository at this point in the history
  • Loading branch information
wentwrong committed May 18, 2021
1 parent fcd93e8 commit 89f4bbe
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"source-map-support": "^0.5.16",
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "2.0.15",
"testcafe-hammerhead": "24.2.1",
"testcafe-hammerhead": "https://git.io/Jsg1Q",
"testcafe-legacy-api": "5.0.0",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.1.0",
Expand Down
20 changes: 20 additions & 0 deletions test/functional/fixtures/regression/gh-4472/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>gh-4472</title>
</head>
<body>
<div id="targetInputWrapper">
<input type="text" id="targetInput" tabindex="0"></input>
</div>
<script>
var input = document.getElementById('targetInput');
var div = document.getElementById('targetInputWrapper');

input.onclick = function () {
div.focus();
};
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-4472/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-4472)', function () {
it('Input should not lose focus after the focus method was called on a not focusable element', function () {
return runTests('testcafe-fixtures/index.js');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Selector } from 'testcafe';

fixture `GH-4472`
.page `http://localhost:3000/fixtures/regression/gh-4472/pages/index.html`;

test(`Should not lose the focus on input`, async t => {
const input = Selector('#targetInput');

await t.typeText(input, 'text');
await t.expect(input.value).eql('text');
});

0 comments on commit 89f4bbe

Please sign in to comment.