@@ -34,11 +34,14 @@ angular.scenario.dsl('sleep', function() {
34
34
* browser().navigateTo(url) Loads the url into the frame
35
35
* browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to
36
36
* browser().reload() refresh the page (reload the same URL)
37
- * browser().location().href() the full URL of the page
38
- * browser().location().hash() the full hash in the url
39
- * browser().location().path() the full path in the url
40
- * browser().location().hashSearch() the hashSearch Object from angular
41
- * browser().location().hashPath() the hashPath string from angular
37
+ * browser().window.href() window.location.href
38
+ * browser().window.path() window.location.pathname
39
+ * browser().window.search() window.location.search
40
+ * browser().window.hash() window.location.hash without # prefix
41
+ * browser().location().url() see angular.service.$location#url
42
+ * browser().location().path() see angular.service.$location#path
43
+ * browser().location().search() see angular.service.$location#search
44
+ * browser().location().hash() see angular.service.$location#hash
42
45
*/
43
46
angular . scenario . dsl ( 'browser' , function ( ) {
44
47
var chain = { } ;
@@ -65,42 +68,60 @@ angular.scenario.dsl('browser', function() {
65
68
} ) ;
66
69
} ;
67
70
68
- chain . location = function ( ) {
71
+ chain . window = function ( ) {
69
72
var api = { } ;
70
73
71
74
api . href = function ( ) {
72
- return this . addFutureAction ( 'browser url ' , function ( $window , $document , done ) {
75
+ return this . addFutureAction ( 'window.location.href ' , function ( $window , $document , done ) {
73
76
done ( null , $window . location . href ) ;
74
77
} ) ;
75
78
} ;
76
79
80
+ api . path = function ( ) {
81
+ return this . addFutureAction ( 'window.location.path' , function ( $window , $document , done ) {
82
+ done ( null , $window . location . pathname ) ;
83
+ } ) ;
84
+ } ;
85
+
86
+ api . search = function ( ) {
87
+ return this . addFutureAction ( 'window.location.search' , function ( $window , $document , done ) {
88
+ done ( null , $window . location . search ) ;
89
+ } ) ;
90
+ } ;
91
+
77
92
api . hash = function ( ) {
78
- return this . addFutureAction ( 'browser url hash' , function ( $window , $document , done ) {
93
+ return this . addFutureAction ( 'window.location. hash' , function ( $window , $document , done ) {
79
94
done ( null , $window . location . hash . replace ( '#' , '' ) ) ;
80
95
} ) ;
81
96
} ;
82
97
83
- api . path = function ( ) {
84
- return this . addFutureAction ( 'browser url path' , function ( $window , $document , done ) {
85
- done ( null , $window . location . pathname ) ;
98
+ return api ;
99
+ } ;
100
+
101
+ chain . location = function ( ) {
102
+ var api = { } ;
103
+
104
+ api . url = function ( ) {
105
+ return this . addFutureAction ( '$location.url()' , function ( $window , $document , done ) {
106
+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . url ( ) ) ;
86
107
} ) ;
87
108
} ;
88
109
89
- api . search = function ( ) {
90
- return this . addFutureAction ( 'browser url search ' , function ( $window , $document , done ) {
91
- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . search ) ;
110
+ api . path = function ( ) {
111
+ return this . addFutureAction ( '$location.path() ' , function ( $window , $document , done ) {
112
+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . path ( ) ) ;
92
113
} ) ;
93
114
} ;
94
115
95
- api . hashSearch = function ( ) {
96
- return this . addFutureAction ( 'browser url hash search' , function ( $window , $document , done ) {
97
- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hashSearch ) ;
116
+ api . search = function ( ) {
117
+ return this . addFutureAction ( '$location. search() ' , function ( $window , $document , done ) {
118
+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . search ( ) ) ;
98
119
} ) ;
99
120
} ;
100
121
101
- api . hashPath = function ( ) {
102
- return this . addFutureAction ( 'browser url hash path ' , function ( $window , $document , done ) {
103
- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hashPath ) ;
122
+ api . hash = function ( ) {
123
+ return this . addFutureAction ( '$location. hash() ' , function ( $window , $document , done ) {
124
+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hash ( ) ) ;
104
125
} ) ;
105
126
} ;
106
127
0 commit comments