aboutsummaryrefslogtreecommitdiffstats
path: root/test/BinderTest.js
diff options
context:
space:
mode:
authorMisko Hevery2010-01-28 22:10:49 -0800
committerMisko Hevery2010-01-28 22:11:01 -0800
commita9c182764b5feeb2466c4bb32f7572762f7fab6d (patch)
tree48105ad598ca6779e3308b06b12576a366e9be71 /test/BinderTest.js
parentdd9d8bf030688f589af6d47064a0d0eafea41bfa (diff)
downloadangular.js-a9c182764b5feeb2466c4bb32f7572762f7fab6d.tar.bz2
added formatters
Diffstat (limited to 'test/BinderTest.js')
-rw-r--r--test/BinderTest.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js
index cf2fa31a..450100e4 100644
--- a/test/BinderTest.js
+++ b/test/BinderTest.js
@@ -129,10 +129,10 @@ BinderTest.prototype.testChangingRadioUpdatesModel = function(){
};
BinderTest.prototype.testChangingCheckboxUpdatesModel = function(){
- var form = compile('<input type="checkbox" name="model.price" value="A" checked>');
+ var form = compile('<input type="checkbox" name="model.price" value="true" checked ng-format="boolean">');
form.scope.set('model', {});
form.binder.updateView();
- assertEquals('A', form.scope.get('model').price);
+ assertEquals(true, form.scope.get('model').price);
};
BinderTest.prototype.testBindUpdate = function() {
@@ -951,3 +951,16 @@ BinderTest.prototype.testItShouldRenderMultiRootHtmlInBinding = function() {
'<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>',
x.node.sortedHtml());
};
+
+BinderTest.prototype.testItShouldUseFormaterForText = function() {
+ var x = compile('<input name="a" ng-format="list" value="a,b">');
+ x.binder.updateView();
+ assertEquals(['a','b'], x.scope.get('a'));
+ var input = x.node.find('input');
+ input[0].value = ' x,,yz';
+ input.change();
+ assertEquals(['x','yz'], x.scope.get('a'));
+ x.scope.set('a', [1 ,2, 3]);
+ x.binder.updateView();
+ assertEquals('1, 2, 3', input[0].value);
+};