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

Commit d452e06

Browse files
committed
update test
1 parent c39aa8c commit d452e06

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/html/load.html

+12-4
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,33 @@
1212
chai.assert.ok(s, 'load event target can be used to find element in import');
1313
}
1414
}
15+
16+
function importError(event) {
17+
window.loadEvents++;
18+
}
19+
1520
window.importLoaded = importLoaded;
21+
window.importError = importError;
1622
})();
1723
</script>
1824
<script src="../../../tools/test/htmltest.js"></script>
1925
<script src="../../../tools/test/chai/chai.js"></script>
2026
<script src="../../html-imports.js"></script>
2127
<link rel="import" href="imports/load-1.html" onload="importLoaded(event)">
2228
<link rel="import" href="imports/load-2.html" onload="importLoaded(event)">
23-
<link rel="import" href="imports/404.html" onerror="importLoaded(event)">
29+
<!-- TODO(sorvell): note, native imports currently fires onload for 404
30+
documents. This doesn't really make sense, check spec.
31+
See: https://code.google.com/p/chromium/issues/detail?id=336609
32+
-->
33+
<link rel="import" href="imports/404.html" onload="importError(event)" onerror="importError(event)">
2434
</head>
2535
<body>
2636
<div id="test1" class="red">Test</div>
2737
<div id="test2" class="blue">Test</div>
2838
<div id="test3" class="image"></div>
2939
<script>
3040
document.addEventListener('HTMLImportsLoaded', function() {
31-
// TODO(sorvell): onerror doesn't work in native, filing bug...
32-
var num = HTMLImports.useNative ? 2 : 3;
33-
chai.assert.equal(loadEvents, num, 'expected # of load events');
41+
chai.assert.equal(loadEvents, 3, 'expected # of load events');
3442
var test1 = getComputedStyle(document.querySelector('#test1')).backgroundColor;
3543
chai.assert.equal(test1, 'rgb(255, 0, 0)');
3644
var test2 = getComputedStyle(document.querySelector('#test2')).backgroundColor;

0 commit comments

Comments
 (0)