From 2430f52bb97fa9d682e5f028c977c5bf94c5ec38 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 23 Mar 2012 14:03:24 -0700 Subject: chore(module): move files around in preparation for more modules --- test/directive/ngSwitchSpec.js | 93 ------------------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 test/directive/ngSwitchSpec.js (limited to 'test/directive/ngSwitchSpec.js') diff --git a/test/directive/ngSwitchSpec.js b/test/directive/ngSwitchSpec.js deleted file mode 100644 index b4df109e..00000000 --- a/test/directive/ngSwitchSpec.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -describe('ng-switch', function() { - var element; - - - afterEach(function(){ - dealoc(element); - }); - - - it('should switch on value change', inject(function($rootScope, $compile) { - element = $compile( - '
' + - '
first:{{name}}
' + - '
second:{{name}}
' + - '
true:{{name}}
' + - '
')($rootScope); - expect(element.html()).toEqual( - ''); - $rootScope.select = 1; - $rootScope.$apply(); - expect(element.text()).toEqual('first:'); - $rootScope.name="shyam"; - $rootScope.$apply(); - expect(element.text()).toEqual('first:shyam'); - $rootScope.select = 2; - $rootScope.$apply(); - expect(element.text()).toEqual('second:shyam'); - $rootScope.name = 'misko'; - $rootScope.$apply(); - expect(element.text()).toEqual('second:misko'); - $rootScope.select = true; - $rootScope.$apply(); - expect(element.text()).toEqual('true:misko'); - })); - - - it('should switch on switch-when-default', inject(function($rootScope, $compile) { - element = $compile( - '' + - '
one
' + - '
other
' + - '
')($rootScope); - $rootScope.$apply(); - expect(element.text()).toEqual('other'); - $rootScope.select = 1; - $rootScope.$apply(); - expect(element.text()).toEqual('one'); - })); - - - it('should call change on switch', inject(function($rootScope, $compile) { - element = $compile( - '' + - '
{{name}}
' + - '
')($rootScope); - $rootScope.url = 'a'; - $rootScope.$apply(); - expect($rootScope.name).toEqual('works'); - expect(element.text()).toEqual('works'); - })); - - - it('should properly create and destroy child scopes', inject(function($rootScope, $compile) { - element = $compile( - '' + - '
{{name}}
' + - '
')($rootScope); - $rootScope.$apply(); - - var getChildScope = function() { return element.find('div').scope(); }; - - expect(getChildScope()).toBeUndefined(); - - $rootScope.url = 'a'; - $rootScope.$apply(); - var child1 = getChildScope(); - expect(child1).toBeDefined(); - spyOn(child1, '$destroy'); - - $rootScope.url = 'x'; - $rootScope.$apply(); - expect(getChildScope()).toBeUndefined(); - expect(child1.$destroy).toHaveBeenCalledOnce(); - - $rootScope.url = 'a'; - $rootScope.$apply(); - var child2 = getChildScope(); - expect(child2).toBeDefined(); - expect(child2).not.toBe(child1); - })); -}); -- cgit v1.2.3