@@ -257,28 +257,22 @@ describe('animations', function() {
257257
258258 it ( 'should throw a minErr if a regex value is used which partially contains or fully matches the `ng-animate` CSS class' ,
259259 module ( function ( $animateProvider ) {
260- var errorMessage = '$animateProvider.classNameFilter(regex) prohibits accepting a regex ' +
261- 'value which matches/contains the " ng-animate" CSS class.' ;
262-
263- assertError ( / n g - a n i m a t e / , true ) ;
264- assertError ( / f i r s t n g - a n i m a t e l a s t / , true ) ;
265- assertError ( / n g - a n i m a t e - s p e c i a l / , false ) ;
266- assertError ( / f i r s t n g - a n i m a t e - s p e c i a l l a s t / , false ) ;
267- assertError ( / f i r s t n g - a n i m a t e n g - a n i m a t e - s p e c i a l l a s t / , true ) ;
268- assertError ( / ( n g - a n i m a t e ) / , true ) ;
269- assertError ( / ( f o o | n g - a n i m a t e | b a r ) / , true ) ;
270- assertError ( / ( f o o | ) n g - a n i m a t e ( | b a r ) / , true ) ;
271-
272- function assertError ( regex , bool ) {
273- var expectation = expect ( function ( ) {
260+ expect ( setFilter ( / n g - a n i m a t e / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
261+ expect ( setFilter ( / f i r s t n g - a n i m a t e l a s t / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
262+ expect ( setFilter ( / f i r s t n g - a n i m a t e n g - a n i m a t e - s p e c i a l l a s t / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
263+ expect ( setFilter ( / ( n g - a n i m a t e ) / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
264+ expect ( setFilter ( / ( f o o | n g - a n i m a t e | b a r ) / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
265+ expect ( setFilter ( / ( f o o | ) n g - a n i m a t e ( | b a r ) / ) ) . toThrowMinErr ( '$animate' , 'nongcls' ) ;
266+
267+ expect ( setFilter ( / n g - a n i m a t e r / ) ) . not . toThrow ( ) ;
268+ expect ( setFilter ( / m y - n g - a n i m a t e / ) ) . not . toThrow ( ) ;
269+ expect ( setFilter ( / f i r s t n g - a n i m a t e r l a s t / ) ) . not . toThrow ( ) ;
270+ expect ( setFilter ( / f i r s t m y - n g - a n i m a t e l a s t / ) ) . not . toThrow ( ) ;
271+
272+ function setFilter ( regex ) {
273+ return function ( ) {
274274 $animateProvider . classNameFilter ( regex ) ;
275- } ) ;
276-
277- if ( bool ) {
278- expectation . toThrowMinErr ( '$animate' , 'nongcls' , errorMessage ) ;
279- } else {
280- expectation . not . toThrow ( ) ;
281- }
275+ } ;
282276 }
283277 } )
284278 ) ;
0 commit comments