diff --git a/docs/form.md b/docs/form.md index b8f4946c..257caa34 100644 --- a/docs/form.md +++ b/docs/form.md @@ -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") } }) @@ -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({ diff --git a/src/widgets/Widget.Form.coffee b/src/widgets/Widget.Form.coffee index 1ede0a6c..8c19a7fa 100644 --- a/src/widgets/Widget.Form.coffee +++ b/src/widgets/Widget.Form.coffee @@ -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)