Commit 2e010527 2e0105274df16918146cb36d99a8770760a80ba0 by Nicolas Perriault

refs #240 - added assertNotVisible

1 parent 60d3246a
......@@ -20,6 +20,7 @@ XXXX-XX-XX, v1.0.0
- fixed [#231](https://github.com/n1k0/casperjs/pull/231) - added `--pre` and `--post` options to the `casperjs test` command to load test files before and after the execution of testsuite
- fixed [#222](https://github.com/n1k0/casperjs/pull/222) & [#211](https://github.com/n1k0/casperjs/issues/211) - Change mouse event to include an X + Y value for click position
- fixed [#232](https://github.com/n1k0/casperjs/issues/232) - symlink resolution in the ruby version of the `casperjs` executable
- fixed [#240](https://github.com/n1k0/casperjs/pull/240/) - added new tester methods: `assertVisible` and `assertNotVisible`
- added [`ClientUtils.getDocumentHeight()`](http://casperjs.org/api.html#clientutils.getDocumentHeight)
- added a `--no-colors` option to the `casper test` command to skip output coloration
......
......@@ -353,6 +353,23 @@ var Tester = function Tester(casper, options) {
};
/**
* Asserts that a selector expression is not currently visible.
*
* @param String expected selector expression
* @param String message Test description
* @return Object An assertion result object
*/
this.assertNotVisible = this.assertInvisible = function assertNotVisible(selector, message) {
return this.assert(!casper.visible(selector), message, {
type: "assertVisible",
standard: "Selector is not visible",
values: {
selector: selector
}
});
};
/**
* Asserts that the provided function called with the given parameters
* will raise an exception.
*
......
......@@ -15,5 +15,6 @@
</ul>
<input type="text" name="dummy_name" value="dummy_value" />
<h1>Title</h1>
<p id="hidden" style="display:none">I'm hidden.</p>
</body>
</html>
......
......@@ -113,6 +113,12 @@ casper.then(function() {
t.comment('Tester.assertUrlMatch()');
t.assertUrlMatch(/index\.html$/, "Tester.assertUrlMatch() works as expected");
t.comment('Tester.assertVisible()');
t.assertVisible('img', 'Tester.assertVisible() works as expected');
t.comment('Tester.assertNotVisible()');
t.assertNotVisible('p#hidden', 'Tester.assertNotVisible() works as expected');
});
casper.then(function() {
......