From 1c796ecc75d8895f50e65160c53f00a875cb9d2b Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 9 Apr 2014 14:11:39 -0700 Subject: [PATCH] Skip loading tests for native imports --- test/html/HTMLImports.html | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/test/html/HTMLImports.html b/test/html/HTMLImports.html index bf93bde..77b30b7 100644 --- a/test/html/HTMLImports.html +++ b/test/html/HTMLImports.html @@ -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(); });