@@ -1881,15 +1881,14 @@ describe('$compile', function() {
1881
1881
1882
1882
1883
1883
it ( 'should throw an error and clear element content if the template fails to load' ,
1884
- inject ( function ( $compile , $exceptionHandler , $ httpBackend, $rootScope ) {
1884
+ inject ( function ( $compile , $httpBackend , $rootScope ) {
1885
1885
$httpBackend . expect ( 'GET' , 'hello.html' ) . respond ( 404 , 'Not Found!' ) ;
1886
1886
element = $compile ( '<div><b class="hello">content</b></div>' ) ( $rootScope ) ;
1887
1887
1888
- $httpBackend . flush ( ) ;
1889
-
1888
+ expect ( function ( ) {
1889
+ $httpBackend . flush ( ) ;
1890
+ } ) . toThrowMinErr ( '$compile' , 'tpload' , 'Failed to load template: hello.html' ) ;
1890
1891
expect ( sortedHtml ( element ) ) . toBe ( '<div><b class="hello"></b></div>' ) ;
1891
- expect ( $exceptionHandler . errors [ 0 ] ) . toEqualMinErr ( '$compile' , 'tpload' ,
1892
- 'Failed to load template: hello.html' ) ;
1893
1892
} )
1894
1893
) ;
1895
1894
@@ -1905,13 +1904,13 @@ describe('$compile', function() {
1905
1904
templateUrl : 'template.html'
1906
1905
} ) ) ;
1907
1906
} ) ;
1908
- inject ( function ( $compile , $exceptionHandler , $ httpBackend) {
1907
+ inject ( function ( $compile , $httpBackend ) {
1909
1908
$httpBackend . whenGET ( 'template.html' ) . respond ( '<p>template.html</p>' ) ;
1910
1909
1911
- $compile ( '<div><div class="sync async"></div></div>' ) ;
1912
- $httpBackend . flush ( ) ;
1913
-
1914
- expect ( $exceptionHandler . errors [ 0 ] ) . toEqualMinErr ( '$compile' , 'multidir' ,
1910
+ expect ( function ( ) {
1911
+ $compile ( '<div><div class="sync async"></div></div>' ) ;
1912
+ $httpBackend . flush ( ) ;
1913
+ } ) . toThrowMinErr ( '$compile' , 'multidir' ,
1915
1914
'Multiple directives [async, sync] asking for template on: ' +
1916
1915
'<div class="sync async">' ) ;
1917
1916
} ) ;
@@ -2122,15 +2121,15 @@ describe('$compile', function() {
2122
2121
'multiple root elements' : '<div></div><div></div>'
2123
2122
} , function ( directiveTemplate ) {
2124
2123
2125
- inject ( function ( $compile , $templateCache , $rootScope , $exceptionHandler ) {
2124
+ inject ( function ( $compile , $templateCache , $rootScope ) {
2126
2125
$templateCache . put ( 'template.html' , directiveTemplate ) ;
2127
- $compile ( '<p template></p>' ) ( $rootScope ) ;
2128
- $rootScope . $digest ( ) ;
2129
2126
2130
- expect ( $exceptionHandler . errors . pop ( ) ) . toEqualMinErr ( '$compile' , 'tplrt' ,
2131
- 'Template for directive \'template\' must have exactly one root element. ' +
2132
- 'template.html'
2133
- ) ;
2127
+ expect ( function ( ) {
2128
+ $compile ( '<p template></p>' ) ( $rootScope ) ;
2129
+ $rootScope . $digest ( ) ;
2130
+ } ) . toThrowMinErr ( '$compile' , 'tplrt' ,
2131
+ 'Template for directive \'template\' must have exactly one root element. ' +
2132
+ 'template.html' ) ;
2134
2133
} ) ;
2135
2134
} ) ;
2136
2135
@@ -2657,13 +2656,13 @@ describe('$compile', function() {
2657
2656
) ;
2658
2657
2659
2658
it ( 'should not allow more than one isolate/new scope creation per element regardless of `templateUrl`' ,
2660
- inject ( function ( $exceptionHandler , $ httpBackend) {
2659
+ inject ( function ( $httpBackend ) {
2661
2660
$httpBackend . expect ( 'GET' , 'tiscope.html' ) . respond ( '<div>Hello, world !</div>' ) ;
2662
2661
2663
- compile ( '<div class="tiscope-a; scope-b"></div>' ) ;
2664
- $httpBackend . flush ( ) ;
2665
-
2666
- expect ( $exceptionHandler . errors [ 0 ] ) . toEqualMinErr ( '$compile' , 'multidir' ,
2662
+ expect ( function ( ) {
2663
+ compile ( '<div class="tiscope-a; scope-b"></div>' ) ;
2664
+ $httpBackend . flush ( ) ;
2665
+ } ) . toThrowMinErr ( '$compile' , 'multidir' ,
2667
2666
'Multiple directives [scopeB, tiscopeA] asking for new/isolated scope on: ' +
2668
2667
'<div class="tiscope-a; scope-b ng-scope">' ) ;
2669
2668
} )
@@ -9069,18 +9068,17 @@ describe('$compile', function() {
9069
9068
} ) ) ;
9070
9069
} ) ;
9071
9070
9072
- inject ( function ( $compile , $exceptionHandler , $ rootScope, $templateCache ) {
9071
+ inject ( function ( $compile , $rootScope , $templateCache ) {
9073
9072
$templateCache . put ( 'noTransBar.html' ,
9074
9073
'<div>' +
9075
9074
// This ng-transclude is invalid. It should throw an error.
9076
9075
'<div class="bar" ng-transclude></div>' +
9077
9076
'</div>' ) ;
9078
9077
9079
- element = $compile ( '<div trans-foo>content</div>' ) ( $rootScope ) ;
9080
- $rootScope . $digest ( ) ;
9081
-
9082
- expect ( $exceptionHandler . errors [ 0 ] [ 1 ] ) . toBe ( '<div class="bar" ng-transclude="">' ) ;
9083
- expect ( $exceptionHandler . errors [ 0 ] [ 0 ] ) . toEqualMinErr ( 'ngTransclude' , 'orphan' ,
9078
+ expect ( function ( ) {
9079
+ element = $compile ( '<div trans-foo>content</div>' ) ( $rootScope ) ;
9080
+ $rootScope . $digest ( ) ;
9081
+ } ) . toThrowMinErr ( 'ngTransclude' , 'orphan' ,
9084
9082
'Illegal use of ngTransclude directive in the template! ' +
9085
9083
'No parent directive that requires a transclusion found. ' +
9086
9084
'Element: <div class="bar" ng-transclude="">' ) ;
@@ -9893,13 +9891,13 @@ describe('$compile', function() {
9893
9891
transclude : 'element'
9894
9892
} ) ) ;
9895
9893
} ) ;
9896
- inject ( function ( $compile , $exceptionHandler , $ httpBackend) {
9894
+ inject ( function ( $compile , $httpBackend ) {
9897
9895
$httpBackend . expectGET ( 'template.html' ) . respond ( '<p second>template.html</p>' ) ;
9898
9896
9899
- $compile ( '<div template first></div>' ) ;
9900
- $httpBackend . flush ( ) ;
9901
-
9902
- expect ( $exceptionHandler . errors [ 0 ] ) . toEqualMinErr ( '$compile' , 'multidir' ,
9897
+ expect ( function ( ) {
9898
+ $compile ( '<div template first></div>' ) ;
9899
+ $httpBackend . flush ( ) ;
9900
+ } ) . toThrowMinErr ( '$compile' , 'multidir' ,
9903
9901
'Multiple directives [first, second] asking for transclusion on: <p ' ) ;
9904
9902
} ) ;
9905
9903
} ) ;
0 commit comments