diff --git a/docs/content/guide/unit-testing.ngdoc b/docs/content/guide/unit-testing.ngdoc
index 7afaaf107aa1..063226737147 100644
--- a/docs/content/guide/unit-testing.ngdoc
+++ b/docs/content/guide/unit-testing.ngdoc
@@ -454,7 +454,7 @@ describe("Deep Thought", function() {
beforeAll(module("UltimateQuestion"));
beforeAll(inject(function(DeepThought) {
- expect(DeepThought.answer).toBe(undefined);
+ expect(DeepThought.answer).toBeUndefined();
DeepThought.generateAnswer();
}));
diff --git a/i18n/spec/closureI18nExtractorSpec.js b/i18n/spec/closureI18nExtractorSpec.js
index 2d281ee3ca70..63157e5eb123 100644
--- a/i18n/spec/closureI18nExtractorSpec.js
+++ b/i18n/spec/closureI18nExtractorSpec.js
@@ -272,7 +272,7 @@ describe("serializeContent", function() {
it("should not transform arrays into objects", function() {
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo().fr_CA);
var deserializedLocale = eval("(" + serializedContent + ")");
- expect(deserializedLocale.DATETIME_FORMATS.MONTH.length).not.toBe(undefined);
+ expect(deserializedLocale.DATETIME_FORMATS.MONTH.length).not.toBeUndefined();
});
});
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js
index 278a234103d7..33b59d360361 100644
--- a/src/ngMock/angular-mocks.js
+++ b/src/ngMock/angular-mocks.js
@@ -2670,7 +2670,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
* beforeAll(module("UltimateQuestion"));
*
* beforeAll(inject(function(DeepThought) {
- * expect(DeepThought.answer).toBe(undefined);
+ * expect(DeepThought.answer).toBeUndefined();
* DeepThought.generateAnswer();
* }));
*
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index 21b711a1524c..314ff17c0119 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -1068,7 +1068,7 @@ describe('angular', function() {
});
it('should return undefined when jq is not set, no jQuery found (the default)', function() {
- expect(jq()).toBe(undefined);
+ expect(jq()).toBeUndefined();
});
it('should return empty string when jq is enabled manually via [ng-jq] with empty string', function() {
diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js
index d11558c27fa5..349dfe17e662 100644
--- a/test/ApiSpecs.js
+++ b/test/ApiSpecs.js
@@ -11,16 +11,16 @@ describe('api', function() {
map.put(key, value1);
map.put(key, value2);
expect(map.get(key)).toBe(value2);
- expect(map.get({})).toBe(undefined);
+ expect(map.get({})).toBeUndefined();
expect(map.remove(key)).toBe(value2);
- expect(map.get(key)).toBe(undefined);
+ expect(map.get(key)).toBeUndefined();
});
it('should init from an array', function() {
var map = new HashMap(['a','b']);
expect(map.get('a')).toBe(0);
expect(map.get('b')).toBe(1);
- expect(map.get('c')).toBe(undefined);
+ expect(map.get('c')).toBeUndefined();
});
it('should maintain hashKey for object keys', function() {
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index 98c91c8a42c8..a059bf8f93e3 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -356,7 +356,7 @@ describe('jqLite', function() {
expect(div.controller()).toBe('ngController');
expect(div.controller('ngController')).toBe('ngController');
- expect(div.controller('other')).toBe(undefined);
+ expect(div.controller('other')).toBeUndefined();
dealoc(div);
});
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 6b29e087c2a9..999830843ca0 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -3499,11 +3499,11 @@ describe('$compile', function() {
expect(element.attr('ng-my-attr')).toEqual('value');
attr.$set('ngMyAttr', undefined);
- expect(element.attr('ng-my-attr')).toBe(undefined);
+ expect(element.attr('ng-my-attr')).toBeUndefined();
attr.$set('ngMyAttr', 'value');
attr.$set('ngMyAttr', null);
- expect(element.attr('ng-my-attr')).toBe(undefined);
+ expect(element.attr('ng-my-attr')).toBeUndefined();
});
@@ -3988,7 +3988,7 @@ describe('$compile', function() {
describe('object reference', function() {
it('should update local when origin changes', inject(function() {
compile('
');
- expect(componentScope.ref).toBe(undefined);
+ expect(componentScope.ref).toBeUndefined();
expect(componentScope.refAlias).toBe(componentScope.ref);
$rootScope.name = 'misko';
@@ -4151,7 +4151,7 @@ describe('$compile', function() {
describe('optional object reference', function() {
it('should update local when origin changes', inject(function() {
compile('');
- expect(componentScope.optRef).toBe(undefined);
+ expect(componentScope.optRef).toBeUndefined();
expect(componentScope.optRefAlias).toBe(componentScope.optRef);
$rootScope.name = 'misko';
@@ -4168,9 +4168,9 @@ describe('$compile', function() {
it('should not throw exception when reference does not exist', inject(function() {
compile('');
- expect(componentScope.optref).toBe(undefined);
- expect(componentScope.optrefAlias).toBe(undefined);
- expect(componentScope.optreference).toBe(undefined);
+ expect(componentScope.optref).toBeUndefined();
+ expect(componentScope.optrefAlias).toBeUndefined();
+ expect(componentScope.optreference).toBeUndefined();
}));
});
@@ -4225,7 +4225,7 @@ describe('$compile', function() {
describe('one-way binding', function() {
it('should update isolate when the identity of origin changes', inject(function() {
compile('');
- expect(componentScope.owRef).toBe(undefined);
+ expect(componentScope.owRef).toBeUndefined();
expect(componentScope.owRefAlias).toBe(componentScope.owRef);
$rootScope.obj = {value: 'initial'};
@@ -4457,7 +4457,7 @@ describe('$compile', function() {
describe('optional one-way binding', function() {
it('should update local when origin changes', inject(function() {
compile('');
- expect(componentScope.owOptref).toBe(undefined);
+ expect(componentScope.owOptref).toBeUndefined();
expect(componentScope.owOptrefAlias).toBe(componentScope.owOptref);
$rootScope.name = 'misko';
@@ -4474,8 +4474,8 @@ describe('$compile', function() {
it('should not throw exception when reference does not exist', inject(function() {
compile('');
- expect(componentScope.owOptref).toBe(undefined);
- expect(componentScope.owOptrefAlias).toBe(undefined);
+ expect(componentScope.owOptref).toBeUndefined();
+ expect(componentScope.owOptrefAlias).toBeUndefined();
}));
});
});
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js
index 35a0ee44b27a..2c49a63a33db 100644
--- a/test/ng/directive/inputSpec.js
+++ b/test/ng/directive/inputSpec.js
@@ -161,7 +161,7 @@ describe('input', function() {
helper.attrs.$set('placeholder', undefined);
msie && browserTrigger(inputElm, 'input');
- expect(inputElm.attr('placeholder')).toBe(undefined);
+ expect(inputElm.attr('placeholder')).toBeUndefined();
expect(inputElm).toBePristine();
helper.changeInputValueTo('foo');
diff --git a/test/ng/directive/ngModelSpec.js b/test/ng/directive/ngModelSpec.js
index 2210ea01b9fd..b7bc277d8242 100644
--- a/test/ng/directive/ngModelSpec.js
+++ b/test/ng/directive/ngModelSpec.js
@@ -117,8 +117,8 @@ describe('ngModel', function() {
expect(ctrl.$invalid).toBe(true);
ctrl.$setValidity('third', undefined);
- expect(ctrl.$valid).toBe(undefined);
- expect(ctrl.$invalid).toBe(undefined);
+ expect(ctrl.$valid).toBeUndefined();
+ expect(ctrl.$invalid).toBeUndefined();
ctrl.$setValidity('third', null);
expect(ctrl.$valid).toBe(false);
@@ -1001,15 +1001,15 @@ describe('ngModel', function() {
scope.$apply('value = "123"');
expect(ctrl.$pending).toEqual({async: true});
- expect(ctrl.$valid).toBe(undefined);
- expect(ctrl.$invalid).toBe(undefined);
+ expect(ctrl.$valid).toBeUndefined();
+ expect(ctrl.$invalid).toBeUndefined();
expect(defers.length).toBe(1);
expect(isObject(ctrl.$pending)).toBe(true);
scope.$apply('value = "456"');
expect(ctrl.$pending).toEqual({async: true});
- expect(ctrl.$valid).toBe(undefined);
- expect(ctrl.$invalid).toBe(undefined);
+ expect(ctrl.$valid).toBeUndefined();
+ expect(ctrl.$invalid).toBeUndefined();
expect(defers.length).toBe(2);
expect(isObject(ctrl.$pending)).toBe(true);
@@ -1034,8 +1034,8 @@ describe('ngModel', function() {
};
ctrl.$setViewValue('x..y..z');
- expect(ctrl.$valid).toBe(undefined);
- expect(ctrl.$invalid).toBe(undefined);
+ expect(ctrl.$valid).toBeUndefined();
+ expect(ctrl.$invalid).toBeUndefined();
failParser = true;
@@ -1145,8 +1145,8 @@ describe('ngModel', function() {
$rootScope.$digest();
expect(formCtrl.$pending.usernameAvailability).toBeTruthy();
- expect(usernameCtrl.$invalid).toBe(undefined);
- expect(formCtrl.$invalid).toBe(undefined);
+ expect(usernameCtrl.$invalid).toBeUndefined();
+ expect(formCtrl.$invalid).toBeUndefined();
usernameDefer.resolve();
$rootScope.$digest();
@@ -1892,7 +1892,7 @@ describe('ngModelOptions attributes', function() {
'/>');
browserTrigger(inputElm, 'click');
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
browserTrigger(inputElm, 'blur');
expect($rootScope.checkbox).toBe(true);
@@ -1980,9 +1980,9 @@ describe('ngModelOptions attributes', function() {
'/>');
browserTrigger(inputElm, 'click');
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(2000);
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(9000);
expect($rootScope.checkbox).toBe(true);
});
@@ -2038,9 +2038,9 @@ describe('ngModelOptions attributes', function() {
'/>');
helper.changeInputValueTo('a');
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(6000);
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(4000);
expect($rootScope.name).toEqual('a');
helper.changeInputValueTo('b');
@@ -2060,9 +2060,9 @@ describe('ngModelOptions attributes', function() {
inputElm[0].checked = false;
browserTrigger(inputElm, 'click');
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(8000);
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(3000);
expect($rootScope.checkbox).toBe(true);
inputElm[0].checked = true;
@@ -2083,9 +2083,9 @@ describe('ngModelOptions attributes', function() {
inputElm[0].checked = false;
browserTrigger(inputElm, 'click');
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(8000);
- expect($rootScope.checkbox).toBe(undefined);
+ expect($rootScope.checkbox).toBeUndefined();
$timeout.flush(3000);
expect($rootScope.checkbox).toBe(true);
inputElm[0].checked = true;
@@ -2108,9 +2108,9 @@ describe('ngModelOptions attributes', function() {
helper.changeGivenInputTo(inputElm, 'a');
expect($rootScope.name).toEqual(undefined);
browserTrigger(inputElm, 'blur');
- expect($rootScope.name).toBe(undefined);
+ expect($rootScope.name).toBeUndefined();
$timeout.flush(2000);
- expect($rootScope.name).toBe(undefined);
+ expect($rootScope.name).toBeUndefined();
$timeout.flush(9000);
expect($rootScope.name).toEqual('a');
dealoc(doc);
diff --git a/test/ng/directive/ngSrcSpec.js b/test/ng/directive/ngSrcSpec.js
index 4b8b14bd46f7..5a66587ae21e 100644
--- a/test/ng/directive/ngSrcSpec.js
+++ b/test/ng/directive/ngSrcSpec.js
@@ -14,7 +14,7 @@ describe('ngSrc', function() {
element = $compile('
')($rootScope);
$rootScope.$digest();
expect(element.attr('src')).not.toBe('');
- expect(element.attr('src')).toBe(undefined);
+ expect(element.attr('src')).toBeUndefined();
}));
it('should sanitize url', inject(function($rootScope, $compile) {
diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js
index d3466f53de60..8a9237fe19f4 100644
--- a/test/ng/filter/filtersSpec.js
+++ b/test/ng/filter/filtersSpec.js
@@ -161,7 +161,7 @@ describe('filters', function() {
});
it('should pass through null and undefined to be compatible with one-time binding', function() {
- expect(currency(undefined)).toBe(undefined);
+ expect(currency(undefined)).toBeUndefined();
expect(currency(null)).toBe(null);
});
@@ -233,7 +233,7 @@ describe('filters', function() {
it('should pass through null and undefined to be compatible with one-time binding', function() {
expect(number(null)).toBe(null);
- expect(number(undefined)).toBe(undefined);
+ expect(number(undefined)).toBeUndefined();
});
it('should filter exponentially large numbers', function() {
diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js
index bc27ff5b5fe6..d18d9c3ea66d 100644
--- a/test/ng/httpSpec.js
+++ b/test/ng/httpSpec.js
@@ -1413,7 +1413,7 @@ describe('$http', function() {
$httpBackend.flush();
expect(callback.callCount).toBe(3);
- expect(callback.calls[0].args[0]).toBe(undefined);
+ expect(callback.calls[0].args[0]).toBeUndefined();
expect(callback.calls[1].args[0]).toBe(null);
expect(callback.calls[2].args[0]).toBe('');
});
diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js
index a8ac9f4a07ba..1011c1c2983c 100644
--- a/test/ng/parseSpec.js
+++ b/test/ng/parseSpec.js
@@ -1914,7 +1914,7 @@ describe('parser', function() {
expect(scope.$eval('a.b.c.d')).toBeUndefined();
scope.a = undefined;
expect(scope.$eval('a - b')).toBe(0);
- expect(scope.$eval('a + b')).toBe(undefined);
+ expect(scope.$eval('a + b')).toBeUndefined();
scope.a = 0;
expect(scope.$eval('a - b')).toBe(0);
expect(scope.$eval('a + b')).toBe(0);
diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js
index 3e1d55e9ae7e..46888d7ed41f 100644
--- a/test/ng/sceSpecs.js
+++ b/test/ng/sceSpecs.js
@@ -122,11 +122,11 @@ describe('SCE', function() {
}));
it('should wrap undefined into undefined', inject(function($sce) {
- expect($sce.trustAsHtml(undefined)).toBe(undefined);
+ expect($sce.trustAsHtml(undefined)).toBeUndefined();
}));
it('should unwrap undefined into undefined', inject(function($sce) {
- expect($sce.getTrusted($sce.HTML, undefined)).toBe(undefined);
+ expect($sce.getTrusted($sce.HTML, undefined)).toBeUndefined();
}));
it('should wrap null into null', inject(function($sce) {
@@ -207,7 +207,7 @@ describe('SCE', function() {
expect($sce.parseAsJs('true')()).toBe(true);
expect($sce.parseAsJs('false')()).toBe(false);
expect($sce.parseAsJs('null')()).toBe(null);
- expect($sce.parseAsJs('undefined')()).toBe(undefined);
+ expect($sce.parseAsJs('undefined')()).toBeUndefined();
expect($sce.parseAsJs('"string"')()).toBe("string");
}));
diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js
index b1fafceff36d..12fccad5e680 100644
--- a/test/ng/snifferSpec.js
+++ b/test/ng/snifferSpec.js
@@ -122,7 +122,7 @@ describe('$sniffer', function() {
describe('animations', function() {
it('should be either true or false', function() {
inject(function($sniffer) {
- expect($sniffer.animations).not.toBe(undefined);
+ expect($sniffer.animations).not.toBeUndefined();
});
});
@@ -218,7 +218,7 @@ describe('$sniffer', function() {
it('should be either true or false', function() {
inject(function($sniffer) {
- expect($sniffer.transitions).not.toBe(undefined);
+ expect($sniffer.transitions).not.toBeUndefined();
});
});
diff --git a/test/ngAria/ariaSpec.js b/test/ngAria/ariaSpec.js
index ff506d299f34..3c8a83daa240 100644
--- a/test/ngAria/ariaSpec.js
+++ b/test/ngAria/ariaSpec.js
@@ -250,7 +250,7 @@ describe('$aria', function() {
it('should not add a role to a native checkbox', function() {
compileElement('');
- expect(element.attr('role')).toBe(undefined);
+ expect(element.attr('role')).toBeUndefined();
});
it('should add missing role="radio" to custom input', function() {
@@ -260,7 +260,7 @@ describe('$aria', function() {
it('should not add a role to a native radio button', function() {
compileElement('');
- expect(element.attr('role')).toBe(undefined);
+ expect(element.attr('role')).toBeUndefined();
});
it('should add missing role="slider" to custom input', function() {
@@ -270,7 +270,7 @@ describe('$aria', function() {
it('should not add a role to a native range input', function() {
compileElement('');
- expect(element.attr('role')).toBe(undefined);
+ expect(element.attr('role')).toBeUndefined();
});
});
diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js
index 8ac39f02bd4c..484cf3fd023c 100644
--- a/test/ngResource/resourceSpec.js
+++ b/test/ngResource/resourceSpec.js
@@ -81,10 +81,10 @@ describe("basic usage", function() {
});
it('should skip over null/undefined members', function() {
- expect(lookupDottedPath(data, 'a.b.c')).toBe(undefined);
- expect(lookupDottedPath(data, 'a.c.c')).toBe(undefined);
- expect(lookupDottedPath(data, 'a.b.c.d')).toBe(undefined);
- expect(lookupDottedPath(data, 'NOT_EXIST')).toBe(undefined);
+ expect(lookupDottedPath(data, 'a.b.c')).toBeUndefined();
+ expect(lookupDottedPath(data, 'a.c.c')).toBeUndefined();
+ expect(lookupDottedPath(data, 'a.b.c.d')).toBeUndefined();
+ expect(lookupDottedPath(data, 'NOT_EXIST')).toBeUndefined();
});
});
diff --git a/test/ngSanitize/filter/linkySpec.js b/test/ngSanitize/filter/linkySpec.js
index 5077ae9bf406..bb016b14c2aa 100644
--- a/test/ngSanitize/filter/linkySpec.js
+++ b/test/ngSanitize/filter/linkySpec.js
@@ -21,7 +21,7 @@ describe('linky', function() {
});
it('should return `undefined`/`null`/`""` values unchanged', function() {
- expect(linky(undefined)).toBe(undefined);
+ expect(linky(undefined)).toBeUndefined();
expect(linky(null)).toBe(null);
expect(linky('')).toBe('');
});