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/ScenarioSpec.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/ScenarioSpec.js')
| -rw-r--r-- | test/ScenarioSpec.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js index ce8ce69c..14ab82ce 100644 --- a/test/ScenarioSpec.js +++ b/test/ScenarioSpec.js @@ -12,25 +12,25 @@ describe("ScenarioSpec: Compilation", function(){ describe('compilation', function(){ it("should compile dom node and return scope", function(){ var node = jqLite('<div ng:init="a=1">{{b=a+1}}</div>')[0]; - scope = angular.compile(node)().scope; + scope = angular.compile(node)(); expect(scope.a).toEqual(1); expect(scope.b).toEqual(2); }); it("should compile jQuery node and return scope", function(){ - scope = compile(jqLite('<div>{{a=123}}</div>'))().scope; + scope = compile(jqLite('<div>{{a=123}}</div>'))(); expect(jqLite(scope.$element).text()).toEqual('123'); }); it("should compile text node and return scope", function(){ - scope = angular.compile('<div>{{a=123}}</div>')().scope; + scope = angular.compile('<div>{{a=123}}</div>')(); expect(jqLite(scope.$element).text()).toEqual('123'); }); }); describe('scope', function(){ it("should have $set, $get, $eval, $updateView methods", function(){ - scope = angular.compile('<div>{{a}}</div>')().scope; + scope = angular.compile('<div>{{a}}</div>')(); scope.$eval("$invalidWidgets.push({})"); expect(scope.$set("a", 2)).toEqual(2); expect(scope.$get("a")).toEqual(2); @@ -40,7 +40,7 @@ describe("ScenarioSpec: Compilation", function(){ }); it("should have $ objects", function(){ - scope = angular.compile('<div></div>')(angular.scope({$config: {a:"b"}})).scope; + scope = angular.compile('<div></div>')(angular.scope({$config: {a:"b"}})); expect(scope.$service('$location')).toBeDefined(); expect(scope.$get('$eval')).toBeDefined(); expect(scope.$get('$config')).toBeDefined(); @@ -51,7 +51,7 @@ describe("ScenarioSpec: Compilation", function(){ describe("configuration", function(){ it("should take location object", function(){ var url = "http://server/#?book=moby"; - scope = angular.compile("<div>{{$location}}</div>")().scope; + scope = angular.compile("<div>{{$location}}</div>")(); var $location = scope.$service('$location'); var $browser = scope.$service('$browser'); expect($location.hashSearch.book).toBeUndefined(); |
