Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
test(HTMLImports): exclude tests when the browser can not be patched
Browse files Browse the repository at this point in the history
The 2 tests are failing on Chrome 42.
They do work with Chrome 44.
  • Loading branch information
vicb committed May 8, 2015
1 parent 18f5511 commit 0ce149a
Showing 1 changed file with 37 additions and 26 deletions.
63 changes: 37 additions & 26 deletions test/patch/HTMLImports.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,48 @@ describe('HTML Imports', ifEnvSupports(supportsImports, function () {
document.head.appendChild(link);
});

it('should work with onerror', function (done) {
var link;
function supportsOnEvents() {
var link = document.createElement('link');
var linkPropDesc = Object.getOwnPropertyDescriptor(link, 'onerror');
return !(linkPropDesc && linkPropDesc.value === null);
}
supportsOnEvents.message = 'Supports HTMLLinkElement#onxxx patching';

testZone.run(function() {
link = document.createElement('link');
link.rel = 'import';
link.href = 'anotherUrl';
link.onerror = function () {
assertInChildOf(testZone);
document.head.removeChild(link);
done();
};
});

document.head.appendChild(link);
});
ifEnvSupports(supportsOnEvents, function() {
it('should work with onerror', function (done) {
var link;

it('should work with onload', function (done) {
var link;
testZone.run(function() {
link = document.createElement('link');
link.rel = 'import';
link.href = 'anotherUrl';
link.onerror = function () {
assertInChildOf(testZone);
document.head.removeChild(link);
done();
};
});

testZone.run(function() {
link = document.createElement('link');
link.rel = 'import';
link.href = '/base/test/assets/import.html';
link.onload = function () {
assertInChildOf(testZone);
document.head.removeChild(link);
done();
};
document.head.appendChild(link);
});

document.head.appendChild(link);
it('should work with onload', function (done) {
var link;

testZone.run(function() {
link = document.createElement('link');
link.rel = 'import';
link.href = '/base/test/assets/import.html';
link.onload = function () {
assertInChildOf(testZone);
document.head.removeChild(link);
done();
};
});

document.head.appendChild(link);
});
});

}));

0 comments on commit 0ce149a

Please sign in to comment.