// Wait for both templates to be done. Then check if the text has changed
$('script.target-dom').on('template',function(e){
$('.target-dom').on('template',function(e){
count++
if(count==2){
t.equal($('.target1').text(),'1 + 1 = 2')
...
...
@@ -178,15 +191,17 @@
</script>
<!-- Appends with data-append even if { append: false } -->
<script class="append-dom"data-append="true"type="text/html"><iclass="new-dom"><%=n%></i><i class="new-dom"><%= n %></i></script>
<script class="append-dom"data-append="true"data-target=".append-dom-target"type="text/html"><iclass="new-dom-target"><%=n%></i><i class="new-dom-target"><%= n %></i></script>
tape('$().template() with data-append="true" appends data to target',function(t){
varcount=3
t.plan(count*4+2)// 2 tests at the end, plus 2 .on('template') tests x 2 DOM elements
_.range(count).forEach(function(i){
$('script.append-dom')
$('.append-dom')
.one('template',function(e){
t.equals(+text(e.target),i)
t.deepEqual(e.templatedata,{n:i})
...
...
@@ -202,15 +217,16 @@
</script>
<!-- Appends with { append: true } -->
<script class="append-js"type="text/html"><iclass="new-js"><%=n%></i><i class="new-js"><%= n %></i></script>
<script class="append-js"data-target=".append-js-target"type="text/html"><iclass="new-js-target"><%=n%></i><i class="new-js-target"><%= n %></i></script>