xgraph-adapter/Tests/WebViewer/Static/bower_components/webcomponentsjs/tests/template-and-CE.html

68 lines
1.9 KiB
HTML

<!doctype html>
<!--
@license
Copyright (c) 2015 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>Template with HTMLImports Test</title>
<script src="../webcomponents-loader.js"></script>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<body>
<template>
<x-child></x-child>
</template>
<template id="before"></template>
<x-after></x-after>
<script>
var created = [];
var attached = [];
var childCreated = false;
var foundTemplate = false;
class XChild extends HTMLElement {
constructor() {
super();
this.custom = true;
childCreated = true;
}
}
class XAfter extends HTMLElement {
constructor() {
super();
this.custom = true;
var template = document.querySelector('#before');
if (template && template.content) {
foundTemplate = true;
}
}
}
window.customElements.define('x-child', XChild);
window.customElements.define('x-after', XAfter);
suite('template and custom elements', function() {
test('elements within templates not upgraded', function() {
assert(!childCreated);
});
test('templates before elements are bootstrapped before createdCallback', function() {
assert(foundTemplate);
});
});
</script>
</body>
</html>