From c4ef1f2fdd73bdaeda879e596d3d96e4e68cb6fd Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 8 Apr 2010 13:43:40 -0700 Subject: tests failing jstd to show cory --- test/ScenarioSpec.js | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'test/ScenarioSpec.js') diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js index ff3a55b5..9afe8e95 100644 --- a/test/ScenarioSpec.js +++ b/test/ScenarioSpec.js @@ -19,46 +19,33 @@ describe("ScenarioSpec: Compilation", function(){ }); describe("ScenarioSpec: Scope", function(){ - xit("should have set, get, eval, $init, updateView methods", function(){ + it("should have set, get, eval, $init, updateView methods", function(){ var scope = compile('
{{a}}
').$init(); scope.$eval("$invalidWidgets.push({})"); expect(scope.$set("a", 2)).toEqual(2); expect(scope.$get("a")).toEqual(2); expect(scope.$eval("a=3")).toEqual(3); scope.$eval(); - expect(scope.$eval("$invalidWidgets")).toEqual([]); expect(jqLite(scope.$element).text()).toEqual('3'); }); - xit("should have $ objects", function(){ - var scope = compile('
', {a:"b"}); - expect(scope.$get('$anchor')).toBeDefined(); + it("should have $ objects", function(){ + var scope = compile('
', {$config: {a:"b"}}); + expect(scope.$get('$location')).toBeDefined(); expect(scope.$get('$eval')).toBeDefined(); expect(scope.$get('$config')).toBeDefined(); expect(scope.$get('$config.a')).toEqual("b"); - expect(scope.$get('$datastore')).toBeDefined(); }); }); -xdescribe("ScenarioSpec: configuration", function(){ +describe("ScenarioSpec: configuration", function(){ it("should take location object", function(){ - var url = "http://server/#book=moby"; - var onUrlChange; - var location = { - listen:function(fn){onUrlChange=fn;}, - set:function(u){url = u;}, - get:function(){return url;} - }; - var scope = compile("
{{$anchor}}
", {location:location}); - var $anchor = scope.$get('$anchor'); - expect($anchor.book).toBeUndefined(); - expect(onUrlChange).toBeUndefined(); - scope.$init(); - expect($anchor.book).toEqual('moby'); - expect(onUrlChange).toBeDefined(); - - url = "http://server/#book=none"; - onUrlChange(); - expect($anchor.book).toEqual('none'); + var url = "http://server/#?book=moby"; + var scope = compile("
{{$location}}
"); + var $location = scope.$get('$location'); + expect($location.hashSearch.book).toBeUndefined(); + scope.$browser.setUrl(url); + scope.$browser.fireUrlWatchers(); + expect($location.hashSearch.book).toEqual('moby'); }); }); -- cgit v1.2.3