Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 45916fe

Browse files
committed
Add back test for user rejected value
Not sure how this got lost. Asserts that https://github.com/Polymer/NodeBind/blob/master/src/NodeBind.js#L186 is required (otherwise the element wouldn't find out that the value was put back to its initial value, because from it's observable's POV the value would not have changed). R=arv BUG= Review URL: https://codereview.appspot.com/73240044
1 parent 62f7e53 commit 45916fe

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/tests.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ suite('Form Element Bindings', function() {
323323
inputTextAreaPathUnreachable('textarea');
324324
});
325325

326-
test('Input.value - user value rejected', function(done) {
326+
test('Input.value - detailed', function(done) {
327327
var model = {val: 'ping'};
328328

329329
var el = testDiv.appendChild(document.createElement('input'));
@@ -379,6 +379,32 @@ suite('Form Element Bindings', function() {
379379
});
380380
});
381381

382+
test('Input.value - user value rejected', function(done) {
383+
var model = {val: 'ping'};
384+
385+
var rejector = new PathObserver(model, 'val');
386+
rejector.open(function() {
387+
model.val = 'ping';
388+
});
389+
390+
var el = testDiv.appendChild(document.createElement('input'));
391+
el.bind('value', new PathObserver(model, 'val'));
392+
393+
then(function() {
394+
assert.strictEqual('ping', el.value);
395+
396+
el.value = 'pong';
397+
dispatchEvent('input', el);
398+
399+
}).then(function() {
400+
// rejector will have set the bound value back to 'ping'.
401+
assert.strictEqual('ping', el.value);
402+
403+
rejector.close();
404+
done();
405+
});
406+
});
407+
382408
test('(Checkbox)Input.checked', function(done) {
383409
var input = testDiv.appendChild(document.createElement('input'));
384410
testDiv.appendChild(input);

0 commit comments

Comments
 (0)