Skip to content

Commit

Permalink
Rename submitSelector to findSubmit
Browse files Browse the repository at this point in the history
Finishes #247
  • Loading branch information
Jake Buob committed Sep 11, 2014
1 parent 8ab8fc5 commit d7f960c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions docs/form.md
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
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

0 comments on commit d7f960c

Please sign in to comment.