Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit eb785eb

Browse files
committed
updating tests: removing expected errors for falsy restrict values
1 parent f7c7304 commit eb785eb

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

test/ng/compileSpec.js

+10-15
Original file line numberDiff line numberDiff line change
@@ -5561,36 +5561,31 @@ describe('$compile', function() {
55615561
it('should throw badrestrict on first compilation when restrict is invalid', function() {
55625562
module(function($compileProvider, $exceptionHandlerProvider) {
55635563
$compileProvider.directive('invalidRestrictBadString', valueFn({restrict: '"'}));
5564-
$compileProvider.directive('invalidRestrictFalse', valueFn({restrict: false}));
55655564
$compileProvider.directive('invalidRestrictTrue', valueFn({restrict: true}));
55665565
$compileProvider.directive('invalidRestrictObject', valueFn({restrict: {}}));
5567-
$compileProvider.directive('invalidRestrictZero', valueFn({restrict: 0}));
5566+
$compileProvider.directive('invalidRestrictNumber', valueFn({restrict: 42}));
55685567

55695568
// We need to test with the exceptionHandler not rethrowing...
55705569
$exceptionHandlerProvider.mode('log');
55715570
});
55725571

55735572
inject(function($exceptionHandler, $compile, $rootScope) {
5574-
$compile('<div invalid-restrict-false>')($rootScope);
5575-
expect($exceptionHandler.errors.length).toBe(1);
5576-
expect($exceptionHandler.errors[0]).toMatch(/\$compile.*badrestrict.*'false'/);
5577-
55785573
$compile('<div invalid-restrict-true>')($rootScope);
5579-
expect($exceptionHandler.errors.length).toBe(2);
5580-
expect($exceptionHandler.errors[1]).toMatch(/\$compile.*badrestrict.*'true'/);
5574+
expect($exceptionHandler.errors.length).toBe(1);
5575+
expect($exceptionHandler.errors[0]).toMatch(/\$compile.*badrestrict.*'true'/);
55815576

55825577
$compile('<div invalid-restrict-bad-string>')($rootScope);
55835578
$compile('<div invalid-restrict-bad-string>')($rootScope);
5584-
expect($exceptionHandler.errors.length).toBe(3);
5585-
expect($exceptionHandler.errors[2]).toMatch(/\$compile.*badrestrict.*'\"'/);
5579+
expect($exceptionHandler.errors.length).toBe(2);
5580+
expect($exceptionHandler.errors[1]).toMatch(/\$compile.*badrestrict.*'\"'/);
55865581

55875582
$compile('<div invalid-restrict-bad-string invalid-restrict-object>')($rootScope);
5588-
expect($exceptionHandler.errors.length).toBe(4);
5589-
expect($exceptionHandler.errors[3]).toMatch(/\$compile.*badrestrict.*'{}'/);
5583+
expect($exceptionHandler.errors.length).toBe(3);
5584+
expect($exceptionHandler.errors[2]).toMatch(/\$compile.*badrestrict.*'{}'/);
55905585

5591-
$compile('<div invalid-restrict-object invalid-restrict-zero>')($rootScope);
5592-
expect($exceptionHandler.errors.length).toBe(5);
5593-
expect($exceptionHandler.errors[4]).toMatch(/\$compile.*badrestrict.*'0'/);
5586+
$compile('<div invalid-restrict-object invalid-restrict-number>')($rootScope);
5587+
expect($exceptionHandler.errors.length).toBe(4);
5588+
expect($exceptionHandler.errors[3]).toMatch(/\$compile.*badrestrict.*'42'/);
55945589
});
55955590
});
55965591

0 commit comments

Comments
 (0)