mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
68 lines
1.7 KiB
HTML
68 lines
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>template distribute</title>
|
|
<script src="../../polymer.js"></script>
|
|
<script src="../../tools/test/htmltest.js"></script>
|
|
<script src="../../node_modules/chai/chai.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<x-test></x-test>
|
|
|
|
<element name="x-echo">
|
|
<template>
|
|
<div>Echoing:</div>
|
|
<content select="*"></content>
|
|
</template>
|
|
<script>
|
|
Polymer.register(this);
|
|
</script>
|
|
</element>
|
|
|
|
<element name="x-test">
|
|
<template>
|
|
<x-echo id="echo">
|
|
<template repeat="{{list}}">
|
|
<div>{{name}}</div>
|
|
</template>
|
|
</x-echo>
|
|
</template>
|
|
<script>
|
|
Polymer.register(this, {
|
|
ready: function() {
|
|
setTimeout(function() {
|
|
this.list = [
|
|
{name: 'foo'},
|
|
{name: 'bar'}
|
|
];
|
|
dirtyCheck();
|
|
var children = this.$.echo.children;
|
|
|
|
chai.assert.equal(children[0].localName, 'template',
|
|
'shadowDOM dynamic distribution via template');
|
|
chai.assert.equal(children[1].textContent, 'foo',
|
|
'shadowDOM dynamic distribution via template');
|
|
chai.assert.equal(children[2].textContent, 'bar',
|
|
'shadowDOM dynamic distribution via template');
|
|
|
|
if (window.ShadowDOMPolyfill) {
|
|
var actualChildren = this.$.echo.impl.children;
|
|
chai.assert.equal(actualChildren.length, 4,
|
|
'shadowDOMPolyfill distributes expected number of actual children.');
|
|
}
|
|
|
|
done();
|
|
}.bind(this), 0);
|
|
}
|
|
});
|
|
</script>
|
|
</element>
|
|
|
|
<script>
|
|
document.addEventListener('WebComponentsReady', function() {
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|