Files
polymer/test/html/template-distribute.html
T
2013-05-13 18:07:25 -07:00

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>