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