Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldewyn committed Sep 21, 2018
1 parent 06cda35 commit 20ecfad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
4 changes: 3 additions & 1 deletion karma.conf.js
Expand Up @@ -13,7 +13,7 @@ var customLaunchers = {};
['firefox', '62.0', 'Windows 10'],
['firefox', '61.0', 'Windows 10'],
['firefox', '60.0', 'Windows 10'], /* ESR */
['firefox', '45.0', 'Linux'], // !!!
['firefox', '45.0', 'Linux'],
['firefox', '62.0', 'macOS 10.13'],
['MicrosoftEdge', '17', 'Windows 10'],
['MicrosoftEdge', '16', 'Windows 10'],
Expand Down Expand Up @@ -117,6 +117,8 @@ module.exports = function(config) {
// how many browser should be started simultaneous
concurrency: 5,

browserDisconnectTimeout: 5000,

sauceLabs: {
testName: 'Hyperform functional tests',
recordScreenshots: true,
Expand Down
40 changes: 22 additions & 18 deletions test/functional/test.regressions.js
Expand Up @@ -139,26 +139,30 @@ describe('Issue 35', function() {

describe('Issue 41', function() {

it('should autoload when requested', function(done) {
var iframe = document.createElement('iframe');
iframe.src = 'blank.html';

document.body.appendChild(iframe);

once(iframe.contentWindow, 'load', function() {
var el = iframe.contentDocument.createElement('script');
el.src = '../../dist/hyperform.js';
el.setAttribute('data-hf-autoload', '');
el.addEventListener('load', function() {
if (! iframe.contentWindow.HTMLInputElement.prototype.checkValidity.__hyperform) {
throw Error('no original checkValidity method detected');
}
iframe.parentNode.removeChild(iframe);
done();
/* IE has no document.currentScript, and apparently it can't be polyfilled
* in IE 11 anyway. */
if (navigator.userAgent.search('Trident') === -1) {
it('should autoload when requested', function(done) {
var iframe = document.createElement('iframe');
iframe.src = 'blank.html';

document.body.appendChild(iframe);

once(iframe.contentWindow, 'load', function() {
var el = iframe.contentDocument.createElement('script');
el.src = '../../dist/hyperform.js';
el.setAttribute('data-hf-autoload', '');
el.addEventListener('load', function() {
if (! iframe.contentWindow.HTMLInputElement.prototype.checkValidity.__hyperform) {
throw Error('no original checkValidity method detected');
}
iframe.parentNode.removeChild(iframe);
done();
});
iframe.contentDocument.body.appendChild(el);
});
iframe.contentDocument.body.appendChild(el);
});
});
}

it('should not autoload when not requested', function(done) {
var iframe = document.createElement('iframe');
Expand Down

0 comments on commit 20ecfad

Please sign in to comment.