diff options
| author | Misko Hevery | 2010-04-09 16:20:15 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-09 16:20:15 -0700 |
| commit | 843bd355d25ebf2369aec79f98cb6704d38497e9 (patch) | |
| tree | 3850d13b9ad8ab6c5dd975c20cf9d849c7429ed2 /test | |
| parent | 41a5c408c242269bf31bc0b774c7304fdf7c2f1c (diff) | |
| download | angular.js-843bd355d25ebf2369aec79f98cb6704d38497e9.tar.bz2 | |
various bug fixes
Diffstat (limited to 'test')
| -rw-r--r-- | test/ApiTest.js | 4 | ||||
| -rw-r--r-- | test/ValidatorsTest.js | 2 | ||||
| -rw-r--r-- | test/markupSpec.js | 5 | ||||
| -rw-r--r-- | test/servicesSpec.js | 14 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 9 |
5 files changed, 31 insertions, 3 deletions
diff --git a/test/ApiTest.js b/test/ApiTest.js index 19860822..5d85987b 100644 --- a/test/ApiTest.js +++ b/test/ApiTest.js @@ -250,3 +250,7 @@ ApiTest.prototype.testStringFromUTC = function(){ assertEquals("2003-09-10T13:02:03Z", angular.Date.toString(date)); assertEquals("str", angular.String.toDate("str")); }; + +ApiTest.prototype.testObjectShouldHaveExtend = function(){ + assertEquals(angular.Object.extend, extend); +}; diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js index 2b2f6753..17c67d38 100644 --- a/test/ValidatorsTest.js +++ b/test/ValidatorsTest.js @@ -12,7 +12,7 @@ ValidatorTest.prototype.testItShouldHaveThisSet = function() { scope.$init(); assertEquals('misko', validator.first); assertEquals('hevery', validator.last); - assertSame(scope, validator._this); + assertSame(scope, validator._this.__proto__); delete angular.validator.myValidator; scope.$element.remove(); }; diff --git a/test/markupSpec.js b/test/markupSpec.js index e416b8ea..a1112490 100644 --- a/test/markupSpec.js +++ b/test/markupSpec.js @@ -47,6 +47,11 @@ describe("markups", function(){ expect(element.html()).toEqual('<option value="A">A</option>'); }); + it('should process all bindings when we have leading space', function(){ + compile('<a> {{a}}<br/>{{b}}</a>'); + expect(sortedHtml(scope.$element)).toEqual('<a> <span ng-bind="a"></span><br></br><span ng-bind="b"></span></a>'); + }); + }); diff --git a/test/servicesSpec.js b/test/servicesSpec.js index b7dfe4c8..91cc1f0e 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -42,6 +42,20 @@ describe("services", function(){ expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html#'); }); + it('should update url on hash change', function(){ + scope.$location.parse('http://server/#path?a=b'); + scope.$location.hash = ''; + expect(scope.$location.toString()).toEqual('http://server/#'); + expect(scope.$location.hashPath).toEqual(''); + }); + + it('should update url on hashPath change', function(){ + scope.$location.parse('http://server/#path?a=b'); + scope.$location.hashPath = ''; + expect(scope.$location.toString()).toEqual('http://server/#?a=b'); + expect(scope.$location.hash).toEqual('?a=b'); + }); + xit('should add stylesheets', function(){ scope.$document = { getElementsByTagName: function(name){ diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index b48656f9..c6158c37 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -207,13 +207,18 @@ describe("input widget", function(){ describe('ng:switch', function(){ it("should match urls", function(){ - var scope = compile('<ng:switch on="url" using="route"><div ng-switch-when="/Book/:name">{{name}}</div></ng:include>'); + var scope = compile('<ng:switch on="url" using="route:params"><div ng-switch-when="/Book/:name">{{params.name}}</div></ng:include>'); scope.url = '/Book/Moby'; scope.$init(); -// jstestdriver.console.log('text'); expect(scope.$element.text()).toEqual('Moby'); }); + it("should match sandwich ids", function(){ + var scope = {}; + var match = angular.widget['NG:SWITCH'].route.call(scope, '/a/123/b', '/a/:id'); + expect(match).toBeFalsy(); + }); + it('should call init on switch', function(){ var scope = compile('<ng:switch on="url" change="name=\'works\'"><div ng-switch-when="a">{{name}}</div></ng:include>'); scope.url = 'a'; |
