This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -46,26 +46,27 @@ function MockWindow(options) {
46
46
} ;
47
47
48
48
this . location = {
49
- get href ( ) {
50
- return locationHref ;
51
- } ,
52
- set href ( value ) {
53
- locationHref = value ;
54
- mockWindow . history . state = null ;
55
- historyEntriesLength ++ ;
56
- } ,
57
- get hash ( ) {
58
- return getHash ( locationHref ) ;
59
- } ,
60
- set hash ( value ) {
61
- locationHref = stripHash ( locationHref ) + '#' + value ;
62
- } ,
63
49
replace : function ( url ) {
64
50
locationHref = url ;
65
51
mockWindow . history . state = null ;
66
52
}
67
53
} ;
68
54
55
+ this . location . __defineGetter__ ( 'href' , function getHref ( ) {
56
+ return locationHref ;
57
+ } ) ;
58
+ this . location . __defineSetter__ ( 'href' , function setHref ( value ) {
59
+ locationHref = value ;
60
+ mockWindow . history . state = null ;
61
+ historyEntriesLength ++ ;
62
+ } ) ;
63
+ this . location . __defineGetter__ ( 'hash' , function getHash ( ) {
64
+ return getHash ( locationHref ) ;
65
+ } ) ;
66
+ this . location . __defineSetter__ ( 'hash' , function setHash ( value ) {
67
+ locationHref = stripHash ( locationHref ) + '#' + value ;
68
+ } ) ;
69
+
69
70
this . history = {
70
71
replaceState : noop ,
71
72
pushState : noop
You can’t perform that action at this time.
0 commit comments