Skip to content

Commit

Permalink
test: convert XNestedRepeat to use an inlined string template.
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Aug 3, 2017
1 parent 28ed27e commit c89155b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/unit/dom-repeat-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@
});
</script>

<dom-module id="x-nested-repeat">
<template>
<script>
let XNestedRepeat = Polymer({
_template: `
<template id="repeater" is="dom-repeat" items="{{items}}" as="itema" index-as="indexa" on-dom-change="domUpdateHandler">
<x-foo on-test1="testHandler1"
innera-prop="{{innera.prop}}"
Expand Down Expand Up @@ -241,14 +242,11 @@
indexa="{{indexa}}"
indexb="{{indexb}}"
indexc="{{indexc}}">
</x-foo>
</x-foo>
</template>
</template>
</template>
</template>
</dom-module>
<script>
let XNestedRepeat = Polymer({
`,
is: 'x-nested-repeat',
testHandler1Count: 0,
testHandler2Count: 0,
Expand All @@ -269,7 +267,11 @@
});
class XNestedRepeatMutable extends Polymer.MutableData(XNestedRepeat) {
static get template() {
return this.makeRepeatsMutable(XNestedRepeat.template.cloneNode(true));
if (!this._templateEl) {
this._templateEl = document.createElement('template');
this._templateEl.innerHTML = XNestedRepeat.template;
}
return this.makeRepeatsMutable(this._templateEl.cloneNode(true));
}
static makeRepeatsMutable(template) {
Array.from(template.content.querySelectorAll('[is=dom-repeat]')).forEach(e => {
Expand Down Expand Up @@ -525,4 +527,4 @@
}
});
</script>
</dom-module>
</dom-module>

0 comments on commit c89155b

Please sign in to comment.