Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename submitSelector to findSubmit #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ Widget.Form

## Table of contents
* [Api](#api)
* [submitSelector](#submitselector)
* [findSubmit](#submitselector)
* [submitForm](#submitform)
* [submitWith](#submitwith)
* [select](#select)
* [fillAll](#fillall)
* [readAll](#readall)

## submitSelector
## findSubmit

`submitSelector` finds and returns an element of type `submit`. It can be overridden to find select another element for the target of [submitForm](#submitform)
`findSubmit` finds and returns an element of type `submit`. It can be overridden to find select another element for the target of [submitForm](#submitform)

```js
var F = new this.Widget.Form.extend({
root: "#my-form",
submitSelector: function(){
findSubmit: function(){
return this.find("button.mySubmit")
}
})
Expand All @@ -29,7 +29,7 @@ var F = new this.Widget.Form.extend({

## submitWith

`submitWith` will call [fillAll](#fillall) on each of keys value pairs passed into method, and then call the `click` method on the return of the `submitSelector` method.
`submitWith` will call [fillAll](#fillall) on each of keys value pairs passed into method, and then call the `click` method on the return of the `findSubmit` method.

```js
var waiver = new this.Widget.Form.extend({
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/Widget.Form.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ _ = require('lodash')
class @Widget.Form extends @Widget
root: 'form'

submitSelector: ->
findSubmit: ->
@find('[type="submit"]')

submitForm: =>
@submitSelector().then (el) -> el.click()
@findSubmit().then (el) -> el.click()

submitWith: (values) =>
@fillAll(values)
Expand Down