Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Skip loading tests for native imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Apr 9, 2014
1 parent 5f44b33 commit 1c796ec
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/html/HTMLImports.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@
var timeout = setTimeout(function() {
chai.assert.fail(null, null, 'timed out');
}, 1000);

if (HTMLImports.useNative) {
clearTimeout(timeout);
done();
}

addEventListener('HTMLImportsLoaded', function() {
clearTimeout(timeout);
if (!HTMLImports.useNative) {
chai.assert.equal(9, Object.keys(HTMLImports.importLoader.cache).length,
'must cache exactly nine resources');
chai.assert.equal(9, Object.keys(HTMLImports.importer.documents).length,
'must cache exactly nine documents');
chai.assert.equal(9, Object.keys(HTMLImports.importLoader.cache).length,
'must cache exactly nine resources');
chai.assert.equal(9, Object.keys(HTMLImports.importer.documents).length,
'must cache exactly nine documents');

Object.keys(HTMLImports.importer.documents).forEach(function(key) {
var doc = HTMLImports.importer.documents[key];
var links = doc.querySelectorAll('link[rel=import]');
Array.prototype.forEach.call(links, function(link) {
var href = link.getAttribute('href');
if (href.indexOf('404') <= 0) {
chai.assert.isDefined(link.import, 'import should have an import property');
}
});
Object.keys(HTMLImports.importer.documents).forEach(function(key) {
var doc = HTMLImports.importer.documents[key];
var links = doc.querySelectorAll('link[rel=import]');
Array.prototype.forEach.call(links, function(link) {
var href = link.getAttribute('href');
if (href.indexOf('404') <= 0) {
chai.assert.isDefined(link.import, 'import should have an import property');
}
});
}
});

done();
});
</script>
Expand Down

0 comments on commit 1c796ec

Please sign in to comment.