diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/matchers.js | 14 | ||||
| -rw-r--r-- | test/ng/locationSpec.js | 13 | ||||
| -rw-r--r-- | test/ngRoute/directive/ngViewSpec.js (renamed from test/ng/directive/ngViewSpec.js) | 8 | ||||
| -rw-r--r-- | test/ngRoute/routeParamsSpec.js (renamed from test/ng/routeParamsSpec.js) | 4 | ||||
| -rw-r--r-- | test/ngRoute/routeSpec.js (renamed from test/ng/routeSpec.js) | 4 |
5 files changed, 26 insertions, 17 deletions
diff --git a/test/matchers.js b/test/matchers.js index 13d284e6..44d6b61e 100644 --- a/test/matchers.js +++ b/test/matchers.js @@ -190,3 +190,17 @@ jasmine.Matchers.prototype.toThrow = function(expected) { return result; }; + + +/** + * Create jasmine.Spy on given method, but ignore calls without arguments + * This is helpful when need to spy only setter methods and ignore getters + */ +function spyOnlyCallsWithArgs(obj, method) { + var spy = spyOn(obj, method); + obj[method] = function() { + if (arguments.length) return spy.apply(this, arguments); + return spy.originalValue.apply(this); + }; + return spy; +} diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index 4aaa4d51..ee920ed9 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -1,18 +1,5 @@ 'use strict'; -/** - * Create jasmine.Spy on given method, but ignore calls without arguments - * This is helpful when need to spy only setter methods and ignore getters - */ -function spyOnlyCallsWithArgs(obj, method) { - var spy = spyOn(obj, method); - obj[method] = function() { - if (arguments.length) return spy.apply(this, arguments); - return spy.originalValue.apply(this); - }; - return spy; -} - describe('$location', function() { var url; diff --git a/test/ng/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index 01ca0d44..6beb3d27 100644 --- a/test/ng/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -3,6 +3,8 @@ describe('ngView', function() { var element; + beforeEach(module('ngRoute')); + beforeEach(module(function($provide) { $provide.value('$window', angular.mock.createMockWindow()); return function($rootScope, $compile, $animator) { @@ -473,7 +475,7 @@ describe('ngView', function() { expect(element.text()).toEqual('WORKS'); var div = element.find('div'); - expect(nodeName_(div.parent())).toEqual('NG:VIEW'); + expect(div.parent()[0].nodeName.toUpperCase()).toBeOneOf('NG:VIEW', 'VIEW'); expect(div.scope()).toBe($route.current.scope); expect(div.scope().hasOwnProperty('state')).toBe(true); @@ -518,7 +520,7 @@ describe('ngView', function() { } function applyCSS(element, cssProp, cssValue) { - element.css(cssProp, cssValue); + element.css(cssProp, cssValue); element.css(vendorPrefix + cssProp, cssValue); } @@ -544,7 +546,7 @@ describe('ngView', function() { })); it('should fire off the enter animation + add and remove the css classes', - inject(function($compile, $rootScope, $sniffer, $location, $templateCache) { + inject(function($compile, $rootScope, $sniffer, $location) { element = $compile(html('<div ng-view ng-animate="{enter: \'custom-enter\'}"></div>'))($rootScope); $location.path('/foo'); diff --git a/test/ng/routeParamsSpec.js b/test/ngRoute/routeParamsSpec.js index 52fe8d2a..1391151c 100644 --- a/test/ng/routeParamsSpec.js +++ b/test/ngRoute/routeParamsSpec.js @@ -1,6 +1,10 @@ 'use strict'; describe('$routeParams', function() { + + beforeEach(module('ngRoute')); + + it('should publish the params into a service', function() { module(function($routeProvider) { $routeProvider.when('/foo', {}); diff --git a/test/ng/routeSpec.js b/test/ngRoute/routeSpec.js index c2651286..300ca2d7 100644 --- a/test/ng/routeSpec.js +++ b/test/ngRoute/routeSpec.js @@ -3,6 +3,8 @@ describe('$route', function() { var $httpBackend; + beforeEach(module('ngRoute')); + beforeEach(module(function() { return function(_$httpBackend_) { $httpBackend = _$httpBackend_; @@ -946,7 +948,7 @@ describe('$route', function() { var routeChangeSpy = jasmine.createSpy('route change'); module(function($routeProvider) { - $routeProvider.when('/bar/:barId', {controller: noop, reloadOnSearch: false}); + $routeProvider.when('/bar/:barId', {controller: angular.noop, reloadOnSearch: false}); }); inject(function($route, $location, $rootScope, $routeParams) { |
