@@ -61,7 +61,7 @@ var Actions = function () {
61
61
* .done();
62
62
* ```
63
63
*
64
- * you can write this instead
64
+ * you can write this:
65
65
*
66
66
* ```javascript
67
67
* test.open('http://doctorwhotv.co.uk/')
@@ -74,6 +74,8 @@ var Actions = function () {
74
74
* .done();
75
75
* ```
76
76
*
77
+ * Always make sure, you terminate it with the [assertions.html#meth-end](end) method!
78
+ *
77
79
* @api
78
80
* @method query
79
81
* @param {string } selector Selector of the element to query
@@ -180,7 +182,7 @@ Actions.prototype.setHttpAuth = function (username, password) {
180
182
* than switches to the iframe context, every action and assertion will be executed within the iFrame context.
181
183
* Btw.: The domain of the IFrame can be whatever you want, this method has no same origin policy restrictions.
182
184
*
183
- * If you wan't to get back to the parents context, you have to use the [#meth- toParent"]( toParent) method.
185
+ * If you wan't to get back to the parents context, you have to use the [toParent](#meth- toParent) method.
184
186
*
185
187
* ```html
186
188
* <div>
@@ -255,7 +257,7 @@ Actions.prototype.toParent = function () {
255
257
* than switches to the window context, every action and assertion will be executed within the chosen window context.
256
258
* Btw.: The domain of the window can be whatever you want, this method has no same origin policy restrictions.
257
259
*
258
- * If you want to get back to the parents context, you have to use the [#meth- toParentWindow"]( toParentWindow) method.
260
+ * If you want to get back to the parents context, you have to use the [toParentWindow](#meth- toParentWindow) method.
259
261
*
260
262
* ```html
261
263
* <div>
@@ -955,6 +957,12 @@ Actions.prototype.setCookie = function (name, contents) {
955
957
956
958
Actions . prototype . waitForElement = function ( selector , timeout ) {
957
959
var hash = uuid . v4 ( ) ;
960
+
961
+ if ( this . querying === true ) {
962
+ timeout = selector ;
963
+ selector = this . selector ;
964
+ }
965
+
958
966
var cb = this . _generateCallbackAssertion ( 'waitForElement' , 'waitForElement' , selector + ' : ' + timeout , hash ) ;
959
967
this . _addToActionQueue ( [ selector , ( timeout ? parseInt ( timeout , 10 ) : 5000 ) , hash ] , 'waitForElement' , cb ) ;
960
968
return this ;
@@ -990,6 +998,39 @@ Actions.prototype._generateCallbackAssertion = function (key, type) {
990
998
return cb ;
991
999
} ;
992
1000
1001
+ /**
1002
+ * Fills the fields of a form with given values.
1003
+ *
1004
+ * ```html
1005
+ * <input type="hidden" value="not really a value" id="ijustwannahaveavalue"/>
1006
+ * ```
1007
+ *
1008
+ * ```javascript
1009
+ * test.open('http://dalekjs.com')
1010
+ * .setValue('#ijustwannahaveavalue', 'a value')
1011
+ * .title().is('DalekJS - Frequently asked questions', 'What the F.A.Q.');
1012
+ * ```
1013
+ *
1014
+ * @api
1015
+ * @method setValue
1016
+ * @param {string } selector
1017
+ * @param {string } value
1018
+ * @return {Actions }
1019
+ */
1020
+
1021
+ Actions . prototype . setValue = function ( selector , value ) {
1022
+ var hash = uuid . v4 ( ) ;
1023
+
1024
+ if ( this . querying === true ) {
1025
+ value = selector ;
1026
+ selector = this . selector ;
1027
+ }
1028
+
1029
+ var cb = this . _generateCallbackAssertion ( 'setValue' , 'setValue' , selector + ' : ' + value , hash ) ;
1030
+ this . _addToActionQueue ( [ selector , value , hash ] , 'setValue' , cb ) ;
1031
+ return this ;
1032
+ } ;
1033
+
993
1034
/**
994
1035
* Adds a method to the queue of actions/assertions to execute
995
1036
*
0 commit comments