File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,53 @@ describe('when a new path is pushed to the URL', function () {
6
6
URLStore . push ( '/a/b/c' ) ;
7
7
} ) ;
8
8
9
+ afterEach ( function ( ) {
10
+ URLStore . teardown ( ) ;
11
+ } ) ;
12
+
9
13
it ( 'has the correct path' , function ( ) {
10
14
expect ( URLStore . getCurrentPath ( ) ) . toEqual ( '/a/b/c' ) ;
11
15
} ) ;
12
16
} ) ;
13
17
14
18
describe ( 'when a new path is used to replace the URL' , function ( ) {
15
19
beforeEach ( function ( ) {
16
- URLStore . push ( '/a/b/c' ) ;
20
+ URLStore . replace ( '/a/b/c' ) ;
21
+ } ) ;
22
+
23
+ afterEach ( function ( ) {
24
+ URLStore . teardown ( ) ;
17
25
} ) ;
18
26
19
27
it ( 'has the correct path' , function ( ) {
20
28
expect ( URLStore . getCurrentPath ( ) ) . toEqual ( '/a/b/c' ) ;
21
29
} ) ;
22
30
} ) ;
31
+
32
+ describe ( 'when going back in history' , function ( ) {
33
+ afterEach ( function ( ) {
34
+ URLStore . teardown ( ) ;
35
+ } ) ;
36
+
37
+ it ( 'has the correct path' , function ( ) {
38
+ URLStore . push ( '/a/b/c' ) ;
39
+ expect ( URLStore . getCurrentPath ( ) ) . toEqual ( '/a/b/c' ) ;
40
+
41
+ URLStore . push ( '/d/e/f' ) ;
42
+ expect ( URLStore . getCurrentPath ( ) ) . toEqual ( '/d/e/f' ) ;
43
+
44
+ URLStore . back ( ) ;
45
+ expect ( URLStore . getCurrentPath ( ) ) . toEqual ( '/a/b/c' ) ;
46
+ } ) ;
47
+
48
+ it ( 'should not go back before recorded history' , function ( ) {
49
+ var error = false ;
50
+ try {
51
+ URLStore . back ( ) ;
52
+ } catch ( e ) {
53
+ error = true ;
54
+ }
55
+
56
+ expect ( error ) . toEqual ( true ) ;
57
+ } ) ;
58
+ } ) ;
You can’t perform that action at this time.
0 commit comments