Commit eb83dddc eb83dddc032dc61d43a8ee08e44aee88c2e4864a by Nicolas Perriault

fixes #149 - fill() searches local form fields again

1 parent 7e41ae04
......@@ -4,13 +4,14 @@ CasperJS Changelog
XXXX-XX-XX, v0.6.11
-------------------
- closed [#132](https://github.com/n1k0/casperjs/issues/132) - added ability to include js/coffee files using a dedicated option when using the `casper test` command
- fixed [#132](https://github.com/n1k0/casperjs/issues/132) - added ability to include js/coffee files using a dedicated option when using the [`casper test` command](http://casperjs.org/testing.html)
- fixed [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls
- fixed [#148](https://github.com/n1k0/casperjs/issues/148) - `utils.isWebPage()` was broken
- fixed [#149](https://github.com/n1k0/casperjs/issues/149) - `ClientUtils.fill()` was searching elements globally
- closed [#144](https://github.com/n1k0/casperjs/issues/144) - added a `safeLogs` option to blur password values in debug logs. **This option is set to `true` by default.**
- fixed [#148](https://github.com/n1k0/casperjs/issues/148) - [`utils.isWebPage()`](http://casperjs.org/api.html#utils.isWebPage) was broken
- fixed [#149](https://github.com/n1k0/casperjs/issues/149) - [`ClientUtils.fill()`](http://casperjs.org/api.html#casper.fill) was searching elements globally
- fixed [#144](https://github.com/n1k0/casperjs/issues/144) - added a [`safeLogs` option](http://casperjs.org/api.html#casper.options) to blur password values in debug logs. **This option is set to `true` by default.**
- added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string
- added `Tester.assertTitleMatch()` method
- added [`Tester.assertTitleMatch()`](http://casperjs.org/api.html#tester.assertTitleMatch) method
- added experimental support of custom headers sending in outgoing request (refs [#137](https://github.com/n1k0/casperjs/issues/137) - PhantomJS 1.6 required)
- switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers
- casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/)
......
......@@ -212,7 +212,7 @@
if (!vals.hasOwnProperty(name)) {
continue;
}
var field = this.findAll('[name="' + name + '"]');
var field = this.findAll('[name="' + name + '"]', form);
var value = vals[name];
if (!field) {
out.errors.push('no field named "' + name + '" in form');
......
......@@ -285,7 +285,7 @@ var Tester = function Tester(casper, options) {
details: "Subject didn't match the provided pattern",
values: {
subject: subject,
pattern: pattern
pattern: pattern.toString()
}
});
};
......@@ -403,7 +403,7 @@ var Tester = function Tester(casper, options) {
details: "Page title does not match the provided pattern",
values: {
subject: currentTitle,
pattern: pattern
pattern: pattern.toString()
}
});
};
......@@ -444,7 +444,7 @@ var Tester = function Tester(casper, options) {
details: "Current url did not match the provided pattern",
values: {
currentUrl: currentUrl,
pattern: pattern
pattern: pattern.toString()
}
});
};
......
<!DOCTYPE html>
<html>
<head>
<title>Multiple forms test</title>
</head>
<body>
<form name="f1">
<input type="hidden" name="f" value="f1">
<input type="text" name="yo">
</form>
<form name="f2">
<input type="hidden" name="f" value="f2">
<input type="text" name="yo">
</form>
</body>
</html>
......@@ -52,6 +52,18 @@ casper.then(function() {
this.test.assertUrlMatch(/topic=bar/, 'Casper.fill() select field was submitted');
});
// multiple forms
casper.thenOpen('tests/site/multiple-forms.html', function() {
this.test.comment('Multiple forms');
this.fill('form[name="f2"]', {
yo: "ok"
}, true);
});
casper.then(function() {
this.test.assertUrlMatch(/\?f=f2&yo=ok$/, 'Casper.fill() handles multiple forms');
}),
casper.run(function() {
this.test.done();
});
......