diff options
| author | Igor Minar | 2011-02-25 14:03:02 -0800 |
|---|---|---|
| committer | Igor Minar | 2011-03-01 17:09:25 -0800 |
| commit | 945056b1667a69ecc4d557cc0f03894597250ced (patch) | |
| tree | 396c0ff155fe895933cbd3301874e8799fd42b65 /test/widgetsSpec.js | |
| parent | 128feb267409ee45ee5225a34aab038ddf3518fa (diff) | |
| download | angular.js-945056b1667a69ecc4d557cc0f03894597250ced.tar.bz2 | |
linking function should return bound scope
angular.compile()() returns {scope:scope, view:view},
this isn't useful at all and only makes tests more verbose.
Instead, this change makes the linking function return scope directly
and if anyone needs the linked dom there are two ways to do it
documented in angular.compile.
other changes:
- moved angular.compile docs to the compiler so that they are closer to
the compiler
- fixed some typos and updated angular.compile docs with the new return
value
Diffstat (limited to 'test/widgetsSpec.js')
| -rw-r--r-- | test/widgetsSpec.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 183fbe6a..dc7ffa77 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -11,7 +11,7 @@ describe("widget", function(){ } else { element = jqLite(html); } - return scope = angular.compile(element)().scope; + return scope = angular.compile(element)(); }; }); @@ -592,7 +592,7 @@ describe("widget", function(){ }); it('should call change on switch', function(){ - var scope = angular.compile('<ng:switch on="url" change="name=\'works\'"><div ng:switch-when="a">{{name}}</div></ng:switch>')().scope; + var scope = angular.compile('<ng:switch on="url" change="name=\'works\'"><div ng:switch-when="a">{{name}}</div></ng:switch>')(); scope.url = 'a'; scope.$eval(); expect(scope.name).toEqual(undefined); @@ -604,7 +604,7 @@ describe("widget", function(){ describe('ng:include', function(){ it('should include on external file', function() { var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>'); - var scope = angular.compile(element)().scope; + var scope = angular.compile(element)(); scope.childScope = createScope(); scope.childScope.name = 'misko'; scope.url = 'myUrl'; @@ -617,7 +617,7 @@ describe("widget", function(){ it('should remove previously included text if a falsy value is bound to src', function() { var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>'); - var scope = angular.compile(element)().scope; + var scope = angular.compile(element)(); scope.childScope = createScope(); scope.childScope.name = 'igor'; scope.url = 'myUrl'; @@ -636,7 +636,7 @@ describe("widget", function(){ it('should allow this for scope', function(){ var element = jqLite('<ng:include src="url" scope="this"></ng:include>'); - var scope = angular.compile(element)().scope; + var scope = angular.compile(element)(); scope.url = 'myUrl'; scope.$service('$xhr.cache').data.myUrl = {value:'{{c=c+1}}'}; scope.$eval(); @@ -650,7 +650,7 @@ describe("widget", function(){ it('should evaluate onload expression when a partial is loaded', function() { var element = jqLite('<ng:include src="url" onload="loaded = true"></ng:include>'); - var scope = angular.compile(element)().scope; + var scope = angular.compile(element)(); expect(scope.loaded).not.toBeDefined(); @@ -801,7 +801,7 @@ describe("widget", function(){ var rootScope, rootScope, $route, $location, $browser; beforeEach(function() { - rootScope = angular.compile('<ng:view></ng:view>')().scope; + rootScope = angular.compile('<ng:view></ng:view>')(); $route = rootScope.$service('$route'); $location = rootScope.$service('$location'); $browser = rootScope.$service('$browser'); @@ -880,7 +880,7 @@ describe("widget", function(){ rootScope = angular.compile( '<div>' + 'include: <ng:include src="\'includePartial.html\'">' + - '</ng:include></div>')(myApp).scope; + '</ng:include></div>')(myApp); $browser.xhr.expectGET('viewPartial.html').respond('content'); $browser.xhr.flush(); |
