Skip to content

Commit 271a9e3

Browse files
committed
Register dom-bind last, add smoke test.
1 parent 4d44aa5 commit 271a9e3

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

polymer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
</script>
8989

9090
<link rel="import" href="src/lib/custom-style.html">
91-
<link rel="import" href="src/lib/template/dom-bind.html">
9291
<link rel="import" href="src/lib/template/dom-template.html">
9392
<link rel="import" href="src/lib/template/dom-repeat.html">
9493
<link rel="import" href="src/lib/template/array-selector.html">
9594
<link rel="import" href="src/lib/template/dom-if.html">
95+
<link rel="import" href="src/lib/template/dom-bind.html">

test/smoke/dom-bind.html

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
5+
<title>dom-bind</title>
6+
7+
<meta charset="utf-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9+
10+
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
11+
<link rel="import" href="../../polymer.html">
12+
13+
</head>
14+
<body>
15+
16+
<template is="dom-bind" id="app">
17+
18+
<h3>Repeat index</h3>
19+
<template is="dom-repeat" items="{{employees}}">
20+
<div style="padding: 3px 0px;">
21+
<button on-tap="modify">Modify</button>
22+
<span>{{index}}</span>
23+
<span>{{item.first}}</span>
24+
<span>{{item.last}}</span>
25+
</div>
26+
</template>
27+
28+
<h3>Show person by index, demonstrate "dom-if" expressions</h3>
29+
<template is="dom-repeat" items="{{employees}}">
30+
<div>
31+
<template is="dom-if" if="{{testit(index)}}">
32+
<div style="padding: 3px 0px;">
33+
<button on-tap="modify">Modify</button>
34+
<span>{{index}}</span>
35+
<span>{{item.first}}</span>
36+
<span>{{item.last}}</span>
37+
</div>
38+
</template>
39+
</div>
40+
</template>
41+
42+
</template>
43+
44+
<script>
45+
var logEl = document.getElementById('log');
46+
var app = document.getElementById('app');
47+
app.testit = function(i) {
48+
return i > 1;
49+
};
50+
app.modify = function(e) {
51+
e.model.set('item.last', e.model.item.last + '*');
52+
};
53+
app.bar = true;
54+
app.employees = [
55+
{first: 'Bob', last: 'Smith'},
56+
{first: 'Sally', last: 'Johnson'},
57+
{first: 'Rob', last: 'Instructs'},
58+
{first: 'Scott', last: 'Explains'},
59+
{first: 'Taylor', last: 'Blogs'}
60+
];
61+
62+
</script>
63+
64+
</body>
65+
</html>

0 commit comments

Comments
 (0)