Decouple Casper `skip` from Tester.
In fact for now the `tester.skip` uses `casper.skip`.
Showing
2 changed files
with
22 additions
and
7 deletions
... | @@ -1619,9 +1619,27 @@ Casper.prototype.thenOpen = function thenOpen(location, settings, then) { | ... | @@ -1619,9 +1619,27 @@ Casper.prototype.thenOpen = function thenOpen(location, settings, then) { |
1619 | * @param Integer nb number of tests to skip | 1619 | * @param Integer nb number of tests to skip |
1620 | * @param String message message to display | 1620 | * @param String message message to display |
1621 | */ | 1621 | */ |
1622 | Casper.prototype.skip = function skip(nb, message) { | ||
1623 | "use strict"; | ||
1624 | var step = this.step, | ||
1625 | steps = this.steps, | ||
1626 | last = steps.length; | ||
1627 | |||
1628 | this.checkStarted(); | ||
1629 | this.step = Math.min(step + nb, last); | ||
1630 | |||
1631 | return this; | ||
1632 | }; | ||
1633 | |||
1634 | /** | ||
1635 | * Skip `nb` steps. | ||
1636 | * | ||
1637 | * @param Integer nb number of tests to skip | ||
1638 | * @param String message message to display | ||
1639 | */ | ||
1622 | Casper.prototype.thenSkip = function (nb, message) { | 1640 | Casper.prototype.thenSkip = function (nb, message) { |
1623 | return this.then(function () { | 1641 | return this.then(function () { |
1624 | this.test.skip(nb, message); | 1642 | this.skip(nb, message); |
1625 | }); | 1643 | }); |
1626 | }; | 1644 | }; |
1627 | 1645 | ||
... | @@ -1638,7 +1656,7 @@ Casper.prototype.thenSkipIf = function (condition, nb, message) { | ... | @@ -1638,7 +1656,7 @@ Casper.prototype.thenSkipIf = function (condition, nb, message) { |
1638 | condition = condition(); | 1656 | condition = condition(); |
1639 | } | 1657 | } |
1640 | if (utils.isTruthy(condition)) { | 1658 | if (utils.isTruthy(condition)) { |
1641 | this.test.skip(nb, message); | 1659 | this.skip(nb, message); |
1642 | } | 1660 | } |
1643 | }); | 1661 | }); |
1644 | }; | 1662 | }; |
... | @@ -1656,7 +1674,7 @@ Casper.prototype.thenSkipUnless = function (condition, nb, message) { | ... | @@ -1656,7 +1674,7 @@ Casper.prototype.thenSkipUnless = function (condition, nb, message) { |
1656 | condition = condition(); | 1674 | condition = condition(); |
1657 | } | 1675 | } |
1658 | if (utils.isFalsy(condition)) { | 1676 | if (utils.isFalsy(condition)) { |
1659 | this.test.skip(nb, message); | 1677 | this.skip(nb, message); |
1660 | } | 1678 | } |
1661 | }); | 1679 | }); |
1662 | }; | 1680 | }; | ... | ... |
... | @@ -236,11 +236,8 @@ Tester.prototype.abort = function abort(message) { | ... | @@ -236,11 +236,8 @@ Tester.prototype.abort = function abort(message) { |
236 | */ | 236 | */ |
237 | Tester.prototype.skip = function skip(nb, message) { | 237 | Tester.prototype.skip = function skip(nb, message) { |
238 | "use strict"; | 238 | "use strict"; |
239 | var step = this.casper.step, | ||
240 | steps = this.casper.steps, | ||
241 | last = steps.length; | ||
242 | 239 | ||
243 | this.casper.step = Math.min(step + nb, last); | 240 | this.casper.skip(nb, message); |
244 | 241 | ||
245 | return this.processAssertionResult({ | 242 | return this.processAssertionResult({ |
246 | success: null, | 243 | success: null, | ... | ... |
-
Please register or sign in to post a comment