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.
…1276) * Fix native blur event preventing (fixes DevExpress#1275) * Update the test
- Loading branch information
1 parent
3495943
commit 034c657
Showing
5 changed files
with
56 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
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
32 changes: 32 additions & 0 deletions
32
test/functional/fixtures/regression/gh-1275/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,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>GH-1275</title> | ||
</head> | ||
<body> | ||
<input id="input1"/> | ||
<input id="input2"/> | ||
|
||
<script> | ||
window.focus(); | ||
|
||
var input1 = document.getElementById('input1'); | ||
var input2 = document.getElementById('input2'); | ||
|
||
input1.addEventListener('keydown', function () { | ||
input1.style.display = 'none'; | ||
|
||
window.setTimeout(function () { | ||
input2.focus(); | ||
}); | ||
}); | ||
|
||
input1.addEventListener('blur', function (e) { | ||
if (e.srcElement.tagName && e.srcElement.tagName.toLowerCase() === 'input') | ||
document.activeElement.blur(); | ||
}); | ||
|
||
</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-1275)', function () { | ||
it('Blur event should not raise too late when an input became hidden in IE', function () { | ||
return runTests('testcafe-fixtures/index-test.js', 'Hide input on blur', { only: ['ie'] }); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
test/functional/fixtures/regression/gh-1275/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,12 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
fixture `gh-1275` | ||
.page `http://localhost:3000/fixtures/regression/gh-1275/pages/index.html`; | ||
|
||
test('Hide input on blur', async t => { | ||
await t | ||
.click('#input1') | ||
.pressKey('tab') | ||
.pressKey('a b c') | ||
.expect(Selector('#input2').value).eql('abc'); | ||
}); |