@@ -1881,15 +1881,14 @@ describe('$compile', function() {
18811881
18821882
18831883 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 ) {
18851885 $httpBackend . expect ( 'GET' , 'hello.html' ) . respond ( 404 , 'Not Found!' ) ;
18861886 element = $compile ( '<div><b class="hello">content</b></div>' ) ( $rootScope ) ;
18871887
1888- $httpBackend . flush ( ) ;
1889-
1888+ expect ( function ( ) {
1889+ $httpBackend . flush ( ) ;
1890+ } ) . toThrowMinErr ( '$compile' , 'tpload' , 'Failed to load template: hello.html' ) ;
18901891 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' ) ;
18931892 } )
18941893 ) ;
18951894
@@ -1905,13 +1904,13 @@ describe('$compile', function() {
19051904 templateUrl : 'template.html'
19061905 } ) ) ;
19071906 } ) ;
1908- inject ( function ( $compile , $exceptionHandler , $ httpBackend) {
1907+ inject ( function ( $compile , $httpBackend ) {
19091908 $httpBackend . whenGET ( 'template.html' ) . respond ( '<p>template.html</p>' ) ;
19101909
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' ,
19151914 'Multiple directives [async, sync] asking for template on: ' +
19161915 '<div class="sync async">' ) ;
19171916 } ) ;
@@ -2122,15 +2121,15 @@ describe('$compile', function() {
21222121 'multiple root elements' : '<div></div><div></div>'
21232122 } , function ( directiveTemplate ) {
21242123
2125- inject ( function ( $compile , $templateCache , $rootScope , $exceptionHandler ) {
2124+ inject ( function ( $compile , $templateCache , $rootScope ) {
21262125 $templateCache . put ( 'template.html' , directiveTemplate ) ;
2127- $compile ( '<p template></p>' ) ( $rootScope ) ;
2128- $rootScope . $digest ( ) ;
21292126
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' ) ;
21342133 } ) ;
21352134 } ) ;
21362135
@@ -2657,13 +2656,13 @@ describe('$compile', function() {
26572656 ) ;
26582657
26592658 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 ) {
26612660 $httpBackend . expect ( 'GET' , 'tiscope.html' ) . respond ( '<div>Hello, world !</div>' ) ;
26622661
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' ,
26672666 'Multiple directives [scopeB, tiscopeA] asking for new/isolated scope on: ' +
26682667 '<div class="tiscope-a; scope-b ng-scope">' ) ;
26692668 } )
@@ -9069,18 +9068,17 @@ describe('$compile', function() {
90699068 } ) ) ;
90709069 } ) ;
90719070
9072- inject ( function ( $compile , $exceptionHandler , $ rootScope, $templateCache ) {
9071+ inject ( function ( $compile , $rootScope , $templateCache ) {
90739072 $templateCache . put ( 'noTransBar.html' ,
90749073 '<div>' +
90759074 // This ng-transclude is invalid. It should throw an error.
90769075 '<div class="bar" ng-transclude></div>' +
90779076 '</div>' ) ;
90789077
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' ,
90849082 'Illegal use of ngTransclude directive in the template! ' +
90859083 'No parent directive that requires a transclusion found. ' +
90869084 'Element: <div class="bar" ng-transclude="">' ) ;
@@ -9893,13 +9891,13 @@ describe('$compile', function() {
98939891 transclude : 'element'
98949892 } ) ) ;
98959893 } ) ;
9896- inject ( function ( $compile , $exceptionHandler , $ httpBackend) {
9894+ inject ( function ( $compile , $httpBackend ) {
98979895 $httpBackend . expectGET ( 'template.html' ) . respond ( '<p second>template.html</p>' ) ;
98989896
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' ,
99039901 'Multiple directives [first, second] asking for transclusion on: <p ' ) ;
99049902 } ) ;
99059903 } ) ;
0 commit comments