@@ -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
} )
@@ -8997,18 +8996,17 @@ describe('$compile', function() {
8997
8996
} ) ) ;
8998
8997
} ) ;
8999
8998
9000
- inject ( function ( $compile , $exceptionHandler , $ rootScope, $templateCache ) {
8999
+ inject ( function ( $compile , $rootScope , $templateCache ) {
9001
9000
$templateCache . put ( 'noTransBar.html' ,
9002
9001
'<div>' +
9003
9002
// This ng-transclude is invalid. It should throw an error.
9004
9003
'<div class="bar" ng-transclude></div>' +
9005
9004
'</div>' ) ;
9006
9005
9007
- element = $compile ( '<div trans-foo>content</div>' ) ( $rootScope ) ;
9008
- $rootScope . $digest ( ) ;
9009
-
9010
- expect ( $exceptionHandler . errors [ 0 ] [ 1 ] ) . toBe ( '<div class="bar" ng-transclude="">' ) ;
9011
- expect ( $exceptionHandler . errors [ 0 ] [ 0 ] ) . toEqualMinErr ( 'ngTransclude' , 'orphan' ,
9006
+ expect ( function ( ) {
9007
+ element = $compile ( '<div trans-foo>content</div>' ) ( $rootScope ) ;
9008
+ $rootScope . $digest ( ) ;
9009
+ } ) . toThrowMinErr ( 'ngTransclude' , 'orphan' ,
9012
9010
'Illegal use of ngTransclude directive in the template! ' +
9013
9011
'No parent directive that requires a transclusion found. ' +
9014
9012
'Element: <div class="bar" ng-transclude="">' ) ;
@@ -9821,13 +9819,13 @@ describe('$compile', function() {
9821
9819
transclude : 'element'
9822
9820
} ) ) ;
9823
9821
} ) ;
9824
- inject ( function ( $compile , $exceptionHandler , $ httpBackend) {
9822
+ inject ( function ( $compile , $httpBackend ) {
9825
9823
$httpBackend . expectGET ( 'template.html' ) . respond ( '<p second>template.html</p>' ) ;
9826
9824
9827
- $compile ( '<div template first></div>' ) ;
9828
- $httpBackend . flush ( ) ;
9829
-
9830
- expect ( $exceptionHandler . errors [ 0 ] ) . toEqualMinErr ( '$compile' , 'multidir' ,
9825
+ expect ( function ( ) {
9826
+ $compile ( '<div template first></div>' ) ;
9827
+ $httpBackend . flush ( ) ;
9828
+ } ) . toThrowMinErr ( '$compile' , 'multidir' ,
9831
9829
'Multiple directives [first, second] asking for transclusion on: <p ' ) ;
9832
9830
} ) ;
9833
9831
} ) ;
0 commit comments