@@ -3,7 +3,8 @@ describe('isState filter', function() {
3
3
beforeEach ( module ( function ( $stateProvider ) {
4
4
$stateProvider
5
5
. state ( 'a' , { url : '/' } )
6
- . state ( 'a.b' , { url : '/b' } ) ;
6
+ . state ( 'a.b' , { url : '/b' } )
7
+ . state ( 'with-param' , { url : '/with/:param' } ) ;
7
8
} ) ) ;
8
9
9
10
it ( 'should return true if the current state exactly matches the input state' , inject ( function ( $parse , $state , $q , $rootScope ) {
@@ -17,6 +18,18 @@ describe('isState filter', function() {
17
18
$q . flush ( ) ;
18
19
expect ( $parse ( '"a" | isState' ) ( $rootScope ) ) . toBe ( false ) ;
19
20
} ) ) ;
21
+
22
+ it ( 'should return true if the current state and param matches the input state' , inject ( function ( $parse , $state , $q , $rootScope ) {
23
+ $state . go ( 'with-param' , { param : 'a' } ) ;
24
+ $q . flush ( ) ;
25
+ expect ( $parse ( '"with-param" | isState: {param: "a"}' ) ( $rootScope ) ) . toBe ( true ) ;
26
+ } ) ) ;
27
+
28
+ it ( 'should return false if the current state and param does not match the input state' , inject ( function ( $parse , $state , $q , $rootScope ) {
29
+ $state . go ( 'with-param' , { param : 'b' } ) ;
30
+ $q . flush ( ) ;
31
+ expect ( $parse ( '"with-param" | isState: {param: "a"}' ) ( $rootScope ) ) . toBe ( false ) ;
32
+ } ) ) ;
20
33
} ) ;
21
34
22
35
describe ( 'includedByState filter' , function ( ) {
0 commit comments