@@ -5561,36 +5561,31 @@ describe('$compile', function() {
5561
5561
it ( 'should throw badrestrict on first compilation when restrict is invalid' , function ( ) {
5562
5562
module ( function ( $compileProvider , $exceptionHandlerProvider ) {
5563
5563
$compileProvider . directive ( 'invalidRestrictBadString' , valueFn ( { restrict : '"' } ) ) ;
5564
- $compileProvider . directive ( 'invalidRestrictFalse' , valueFn ( { restrict : false } ) ) ;
5565
5564
$compileProvider . directive ( 'invalidRestrictTrue' , valueFn ( { restrict : true } ) ) ;
5566
5565
$compileProvider . directive ( 'invalidRestrictObject' , valueFn ( { restrict : { } } ) ) ;
5567
- $compileProvider . directive ( 'invalidRestrictZero ' , valueFn ( { restrict : 0 } ) ) ;
5566
+ $compileProvider . directive ( 'invalidRestrictNumber ' , valueFn ( { restrict : 42 } ) ) ;
5568
5567
5569
5568
// We need to test with the exceptionHandler not rethrowing...
5570
5569
$exceptionHandlerProvider . mode ( 'log' ) ;
5571
5570
} ) ;
5572
5571
5573
5572
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 ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' f a l s e ' / ) ;
5577
-
5578
5573
$compile ( '<div invalid-restrict-true>' ) ( $rootScope ) ;
5579
- expect ( $exceptionHandler . errors . length ) . toBe ( 2 ) ;
5580
- expect ( $exceptionHandler . errors [ 1 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' t r u e ' / ) ;
5574
+ expect ( $exceptionHandler . errors . length ) . toBe ( 1 ) ;
5575
+ expect ( $exceptionHandler . errors [ 0 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' t r u e ' / ) ;
5581
5576
5582
5577
$compile ( '<div invalid-restrict-bad-string>' ) ( $rootScope ) ;
5583
5578
$compile ( '<div invalid-restrict-bad-string>' ) ( $rootScope ) ;
5584
- expect ( $exceptionHandler . errors . length ) . toBe ( 3 ) ;
5585
- expect ( $exceptionHandler . errors [ 2 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' \" ' / ) ;
5579
+ expect ( $exceptionHandler . errors . length ) . toBe ( 2 ) ;
5580
+ expect ( $exceptionHandler . errors [ 1 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' \" ' / ) ;
5586
5581
5587
5582
$compile ( '<div invalid-restrict-bad-string invalid-restrict-object>' ) ( $rootScope ) ;
5588
- expect ( $exceptionHandler . errors . length ) . toBe ( 4 ) ;
5589
- expect ( $exceptionHandler . errors [ 3 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' { } ' / ) ;
5583
+ expect ( $exceptionHandler . errors . length ) . toBe ( 3 ) ;
5584
+ expect ( $exceptionHandler . errors [ 2 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' { } ' / ) ;
5590
5585
5591
- $compile ( '<div invalid-restrict-object invalid-restrict-zero >' ) ( $rootScope ) ;
5592
- expect ( $exceptionHandler . errors . length ) . toBe ( 5 ) ;
5593
- expect ( $exceptionHandler . errors [ 4 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' 0 ' / ) ;
5586
+ $compile ( '<div invalid-restrict-object invalid-restrict-number >' ) ( $rootScope ) ;
5587
+ expect ( $exceptionHandler . errors . length ) . toBe ( 4 ) ;
5588
+ expect ( $exceptionHandler . errors [ 3 ] ) . toMatch ( / \$ c o m p i l e .* b a d r e s t r i c t .* ' 4 2 ' / ) ;
5594
5589
} ) ;
5595
5590
} ) ;
5596
5591
0 commit comments