diff options
| author | Misko Hevery | 2010-04-13 14:25:12 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-13 14:25:12 -0700 |
| commit | cd03fe92a5dbd2aba516b64fc8067c5fba1e4a81 (patch) | |
| tree | ccb69ec948074ed744559e0a167f21f0027db6ab /test/widgetsSpec.js | |
| parent | e8ac57caae624dca6509ce1619ae254ffd1fe0f4 (diff) | |
| download | angular.js-cd03fe92a5dbd2aba516b64fc8067c5fba1e4a81.tar.bz2 | |
checkbox widget fix
Diffstat (limited to 'test/widgetsSpec.js')
| -rw-r--r-- | test/widgetsSpec.js | 11 |
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(); |
