passthru context from tester.assertEval and tester.assertEvalEquals to casper.evaluate
Showing
1 changed file
with
7 additions
and
4 deletions
... | @@ -146,9 +146,10 @@ var Tester = function(casper, options) { | ... | @@ -146,9 +146,10 @@ var Tester = function(casper, options) { |
146 | * | 146 | * |
147 | * @param Function fn A function to be evaluated in remote DOM | 147 | * @param Function fn A function to be evaluated in remote DOM |
148 | * @param String message Test description | 148 | * @param String message Test description |
149 | * @param Object context Object containing the parameters to inject into the function | ||
149 | */ | 150 | */ |
150 | this.assertEval = function assertEval(fn, message) { | 151 | this.assertEval = function assertEval(fn, message, context) { |
151 | return this.assert(casper.evaluate(fn), message); | 152 | return this.assert(casper.evaluate(fn, context), message); |
152 | }; | 153 | }; |
153 | 154 | ||
154 | /** | 155 | /** |
... | @@ -158,9 +159,10 @@ var Tester = function(casper, options) { | ... | @@ -158,9 +159,10 @@ var Tester = function(casper, options) { |
158 | * @param Function fn The function to be evaluated in remote DOM | 159 | * @param Function fn The function to be evaluated in remote DOM |
159 | * @param Boolean expected The expected value | 160 | * @param Boolean expected The expected value |
160 | * @param String message Test description | 161 | * @param String message Test description |
162 | * @param Object context Object containing the parameters to inject into the function | ||
161 | */ | 163 | */ |
162 | this.assertEvalEquals = function assertEvalEquals(fn, expected, message) { | 164 | this.assertEvalEquals = function assertEvalEquals(fn, expected, message, context) { |
163 | return this.assertEquals(casper.evaluate(fn), expected, message); | 165 | return this.assertEquals(casper.evaluate(fn, context), expected, message); |
164 | }; | 166 | }; |
165 | 167 | ||
166 | /** | 168 | /** |
... | @@ -174,6 +176,7 @@ var Tester = function(casper, options) { | ... | @@ -174,6 +176,7 @@ var Tester = function(casper, options) { |
174 | return this.assert(casper.exists(selector), message); | 176 | return this.assert(casper.exists(selector), message); |
175 | }; | 177 | }; |
176 | 178 | ||
179 | |||
177 | /** | 180 | /** |
178 | * Asserts that current HTTP status is the one passed as argument. | 181 | * Asserts that current HTTP status is the one passed as argument. |
179 | * | 182 | * | ... | ... |
-
Please register or sign in to post a comment