| Index: tests/tests.js |
| diff --git a/tests/tests.js b/tests/tests.js |
| index 25642610ba6287f18556f194ad5d8dc1e1975bab..3904f47a16dcf4dda2329be270ccce5dfd20b579 100644 |
| --- a/tests/tests.js |
| +++ b/tests/tests.js |
| @@ -1165,6 +1165,56 @@ suite('PolymerExpressions', function() { |
| }) |
| }); |
| + test('two-way binding to root scope', function(done) { |
| + var div = createTestHtml( |
| + '<template bind>' + |
| + '<template bind="{{ foo as foo }}">' + |
| + '<input value="{{ bar }}">' + |
| + '</template>' + |
| + '</template>'); |
| + |
| + var model = { foo: {}, bar: 'bar' }; |
| + |
| + recursivelySetTemplateModel(div, model); |
| + |
| + then(function() { |
| + assert.equal('bar', div.childNodes[2].value); |
| + |
| + div.childNodes[2].value = 'baz'; |
| + dispatchEvent('input', div.childNodes[2]); |
| + |
| + }).then(function() { |
| + assert.equal('baz', model.bar); |
| + |
| + done(); |
| + }) |
| + }); |
| + |
| + test('two-way binding to root scope with transform', function(done) { |
| + var div = createTestHtml( |
| + '<template bind>' + |
| + '<template bind="{{ foo as foo }}">' + |
| + '<input value="{{ bar | plusN(2) }}">' + |
| + '</template>' + |
| + '</template>'); |
| + |
| + var model = { foo: {}, bar: 3 }; |
| + |
| + recursivelySetTemplateModel(div, model); |
| + |
| + then(function() { |
| + assert.equal('5', div.childNodes[2].value); |
| + |
| + div.childNodes[2].value = 8; |
| + dispatchEvent('input', div.childNodes[2]); |
| + |
| + }).then(function() { |
| + assert.equal(6, model.bar); |
| + |
| + done(); |
| + }) |
| + }); |
| + |
| test('two-way filter too many paths', function(done) { |
| var div = createTestHtml( |
| '<template bind="{{ }}">' + |
| @@ -1594,6 +1644,8 @@ suite('PolymerExpressions', function() { |
| this.receiverValue = 'foo'; |
| }, |
| bar: { |
| + callCount: 0, |
| + receiverValue: 'bar', |
| handleBar: function() { |
| this.callCount++; |
| this.receiverValue = 'bar'; |
| @@ -1615,11 +1667,13 @@ suite('PolymerExpressions', function() { |
| assert.strictEqual('foo', model.receiverValue); |
| dispatchEvent('bar', target); |
| - assert.strictEqual(2, model.callCount); |
| - assert.strictEqual('bar', model.receiverValue); |
| + assert.strictEqual(1, model.callCount); |
| + assert.strictEqual('foo', model.receiverValue); |
| + assert.strictEqual(1, model.bar.callCount); |
| + assert.strictEqual('bar', model.bar.receiverValue); |
| dispatchEvent('baz', target); |
| - assert.strictEqual(3, model.callCount); |
| + assert.strictEqual(2, model.callCount); |
| assert.strictEqual('baz', model.receiverValue); |
| // should be ignored because of one-time binding |
| @@ -1628,7 +1682,7 @@ suite('PolymerExpressions', function() { |
| }; |
| dispatchEvent('baz', target); |
| - assert.strictEqual(4, model.callCount); |
| + assert.strictEqual(3, model.callCount); |
| assert.strictEqual('baz', model.receiverValue); |
| done(); |