aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2010-04-13 14:25:12 -0700
committerMisko Hevery2010-04-13 14:25:12 -0700
commitcd03fe92a5dbd2aba516b64fc8067c5fba1e4a81 (patch)
treeccb69ec948074ed744559e0a167f21f0027db6ab /test
parente8ac57caae624dca6509ce1619ae254ffd1fe0f4 (diff)
downloadangular.js-cd03fe92a5dbd2aba516b64fc8067c5fba1e4a81.tar.bz2
checkbox widget fix
Diffstat (limited to 'test')
-rw-r--r--test/widgetsSpec.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index c64f03ca..04b8b1ec 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -6,9 +6,10 @@ describe("input widget", function(){
scope = null;
element = null;
var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget);
- compile = function(html) {
+ compile = function(html, before) {
element = jqLite(html);
scope = compiler.compile(element)(element);
+ (before||noop)();
scope.$init();
};
});
@@ -51,6 +52,14 @@ describe("input widget", function(){
expect(scope.$get('list')).toEqual(['1', '2', '3']);
});
+ it("should process ng-format for booleans", function(){
+ compile('<input type="checkbox" name="name" value="true" ng-format="boolean"/>', function(){
+ scope.name = false;
+ });
+ expect(scope.name).toEqual(false);
+ expect(scope.$element[0].checked).toEqual(false);
+ });
+
it("should process ng-validation", function(){
compile('<input type="text" name="price" value="abc" ng-validate="number"/>');
expect(element.hasClass('ng-validation-error')).toBeTruthy();