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

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Jan 21, 2014
1 parent c39aa8c commit d452e06
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/html/load.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,33 @@
chai.assert.ok(s, 'load event target can be used to find element in import');
}
}

function importError(event) {
window.loadEvents++;
}

window.importLoaded = importLoaded;
window.importError = importError;
})();
</script>
<script src="../../../tools/test/htmltest.js"></script>
<script src="../../../tools/test/chai/chai.js"></script>
<script src="../../html-imports.js"></script>
<link rel="import" href="imports/load-1.html" onload="importLoaded(event)">
<link rel="import" href="imports/load-2.html" onload="importLoaded(event)">
<link rel="import" href="imports/404.html" onerror="importLoaded(event)">
<!-- TODO(sorvell): note, native imports currently fires onload for 404
documents. This doesn't really make sense, check spec.
See: https://code.google.com/p/chromium/issues/detail?id=336609
-->
<link rel="import" href="imports/404.html" onload="importError(event)" onerror="importError(event)">
</head>
<body>
<div id="test1" class="red">Test</div>
<div id="test2" class="blue">Test</div>
<div id="test3" class="image"></div>
<script>
document.addEventListener('HTMLImportsLoaded', function() {
// TODO(sorvell): onerror doesn't work in native, filing bug...
var num = HTMLImports.useNative ? 2 : 3;
chai.assert.equal(loadEvents, num, 'expected # of load events');
chai.assert.equal(loadEvents, 3, 'expected # of load events');
var test1 = getComputedStyle(document.querySelector('#test1')).backgroundColor;
chai.assert.equal(test1, 'rgb(255, 0, 0)');
var test2 = getComputedStyle(document.querySelector('#test2')).backgroundColor;
Expand Down

0 comments on commit d452e06

Please sign in to comment.