Files
webcomponentsjs/tests/WebComponents/html/ce-import.html
2015-10-19 15:08:51 -07:00

44 lines
1.6 KiB
HTML

<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="../../../../web-component-tester/browser.js"></script>
<script src="../../../webcomponents.js"></script>
</head>
<body>
<x-foo></x-foo>
<script>
test('ce-import', function(done) {
// native imports + shadowdom polyfill is not supported so just pass
if (HTMLImports.useNative && window.ShadowDOMPolyfill) {
done();
return;
}
var xfoo = document.querySelector('x-foo');
chai.assert.isUndefined(xfoo.isCreated);
var link = document.createElement('link');
link.rel = 'import';
link.href = 'element-import.html';
document.head.appendChild(link);
HTMLImports.whenReady(function() {
chai.assert.isTrue(xfoo.isCreated, 'element in main document, registered in dynamic import is upgraded');
var ix = link.import.querySelector('x-foo');
chai.assert.isTrue(ix.isCreated, 'element in import, registered in dynamic import is upgraded');
done();
});
});
</script>
</body>
</html>