Skip to content

Commit 247dbb8

Browse files
committed
enhance bind and callback tests.
1 parent 8fedd56 commit 247dbb8

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

test/html/bind.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>bind simple</title>
5+
<script src="../../polymer.js"></script>
6+
<script src="../../tools/test/htmltest.js"></script>
7+
<script src="../../node_modules/chai/chai.js"></script>
8+
</head>
9+
<body>
10+
<x-foo></x-foo>
11+
12+
<polymer-element name="x-bar" noscript>
13+
<template>
14+
x-bar
15+
</template>
16+
</polymer-element>
17+
18+
<polymer-element name="x-foo">
19+
<template>
20+
<div id="foo" foo="{{foo}}"></div>
21+
<div id="bool" foo?="{{foo}}"></div>
22+
<div id="content">{{foo}}</div>
23+
<x-bar id="bar" foo="{{foo}}" ></x-bar>
24+
<x-bar id="barBool" foo?="{{foo}}"></x-bar>
25+
<x-bar id="barContent">{{foo}}</x-bar>
26+
</template>
27+
<script>
28+
Polymer('x-foo', {
29+
foo: 'foo!',
30+
ready: function() {
31+
chai.assert.equal(this.foo, this.$.foo.getAttribute('foo'));
32+
chai.assert.equal(this.$.bool.getAttribute('foo'), '');
33+
chai.assert.isFalse(this.$.bool.hasAttribute('foo?'));
34+
chai.assert.equal(this.$.content.innerHTML, this.foo);
35+
//
36+
chai.assert.equal(this.foo, this.$.bar.getAttribute('foo'));
37+
chai.assert.equal(this.$.barBool.getAttribute('foo'), '');
38+
chai.assert.isFalse(this.$.barBool.hasAttribute('foo?'));
39+
chai.assert.equal(this.$.barContent.innerHTML, this.foo);
40+
done();
41+
}
42+
})
43+
</script>
44+
</polymer-element>
45+
</body>
46+
</html>

test/html/callbacks.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<x-extendor></x-extendor>
1414

15-
<x-repeat></x-repeat>
15+
<x-nested-repeat></x-nested-repeat>
1616

1717
<polymer-element name="x-base">
1818
<script>
@@ -86,6 +86,12 @@
8686
});
8787
</script>
8888
</polymer-element>
89+
90+
<polymer-element name="x-nested-repeat" noscript>
91+
<template>
92+
<x-repeat id="repeat"></x-repeat>
93+
</template>
94+
</polymer-element>
8995

9096
<script>
9197
document.addEventListener('WebComponentsReady', function() {

test/js/bindMDV.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ suite('bindMDV', function() {
5151
});
5252

5353

54-
htmlSuite('unbind', function() {
54+
htmlSuite('bind', function() {
5555
htmlTest('html/template-distribute-dynamic.html');
56+
htmlTest('html/bind.html');
5657
htmlTest('html/unbind.html');
5758
});

0 commit comments

Comments
 (0)