Skip to content

Commit

Permalink
enhance bind and callback tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Sep 17, 2013
1 parent 8fedd56 commit 247dbb8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
46 changes: 46 additions & 0 deletions test/html/bind.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!doctype html>
<html>
<head>
<title>bind simple</title>
<script src="../../polymer.js"></script>
<script src="../../tools/test/htmltest.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
</head>
<body>
<x-foo></x-foo>

<polymer-element name="x-bar" noscript>
<template>
x-bar
</template>
</polymer-element>

<polymer-element name="x-foo">
<template>
<div id="foo" foo="{{foo}}"></div>
<div id="bool" foo?="{{foo}}"></div>
<div id="content">{{foo}}</div>
<x-bar id="bar" foo="{{foo}}" ></x-bar>
<x-bar id="barBool" foo?="{{foo}}"></x-bar>
<x-bar id="barContent">{{foo}}</x-bar>
</template>
<script>
Polymer('x-foo', {
foo: 'foo!',
ready: function() {
chai.assert.equal(this.foo, this.$.foo.getAttribute('foo'));
chai.assert.equal(this.$.bool.getAttribute('foo'), '');
chai.assert.isFalse(this.$.bool.hasAttribute('foo?'));
chai.assert.equal(this.$.content.innerHTML, this.foo);
//
chai.assert.equal(this.foo, this.$.bar.getAttribute('foo'));
chai.assert.equal(this.$.barBool.getAttribute('foo'), '');
chai.assert.isFalse(this.$.barBool.hasAttribute('foo?'));
chai.assert.equal(this.$.barContent.innerHTML, this.foo);
done();
}
})
</script>
</polymer-element>
</body>
</html>
8 changes: 7 additions & 1 deletion test/html/callbacks.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<x-extendor></x-extendor>

<x-repeat></x-repeat>
<x-nested-repeat></x-nested-repeat>

<polymer-element name="x-base">
<script>
Expand Down Expand Up @@ -86,6 +86,12 @@
});
</script>
</polymer-element>

<polymer-element name="x-nested-repeat" noscript>
<template>
<x-repeat id="repeat"></x-repeat>
</template>
</polymer-element>

<script>
document.addEventListener('WebComponentsReady', function() {
Expand Down
3 changes: 2 additions & 1 deletion test/js/bindMDV.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ suite('bindMDV', function() {
});


htmlSuite('unbind', function() {
htmlSuite('bind', function() {
htmlTest('html/template-distribute-dynamic.html');
htmlTest('html/bind.html');
htmlTest('html/unbind.html');
});

0 comments on commit 247dbb8

Please sign in to comment.