|
12 | 12 | chai.assert.ok(s, 'load event target can be used to find element in import');
|
13 | 13 | }
|
14 | 14 | }
|
| 15 | + |
| 16 | + function importError(event) { |
| 17 | + window.loadEvents++; |
| 18 | + } |
| 19 | + |
15 | 20 | window.importLoaded = importLoaded;
|
| 21 | + window.importError = importError; |
16 | 22 | })();
|
17 | 23 | </script>
|
18 | 24 | <script src="../../../tools/test/htmltest.js"></script>
|
19 | 25 | <script src="../../../tools/test/chai/chai.js"></script>
|
20 | 26 | <script src="../../html-imports.js"></script>
|
21 | 27 | <link rel="import" href="imports/load-1.html" onload="importLoaded(event)">
|
22 | 28 | <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)"> |
24 | 34 | </head>
|
25 | 35 | <body>
|
26 | 36 | <div id="test1" class="red">Test</div>
|
27 | 37 | <div id="test2" class="blue">Test</div>
|
28 | 38 | <div id="test3" class="image"></div>
|
29 | 39 | <script>
|
30 | 40 | 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'); |
34 | 42 | var test1 = getComputedStyle(document.querySelector('#test1')).backgroundColor;
|
35 | 43 | chai.assert.equal(test1, 'rgb(255, 0, 0)');
|
36 | 44 | var test2 = getComputedStyle(document.querySelector('#test2')).backgroundColor;
|
|
0 commit comments