Permalink
Browse files

Add submitForm action

To get the submitHandler called, we add a submitForm action on the component, so that it will be called when the form is submitted. Then we retrieve the "submitHandler" property of the component, and call it as a function.

Inner green; outer red: TypeError: this.submitHandler is not a function

Now our component test is able to verify that the submit handler is called. Now the acceptance test errors out because submitting the form expects a submitHandler to be passed in, and there isn't one.
  • Loading branch information...
CodingItWrong committed Jan 11, 2018
1 parent d788159 commit 4569527b768ec53bf2b92b49efcb59eba91a90a0
Showing with 6 additions and 1 deletion.
  1. +5 −0 app/components/post-form.js
  2. +1 −1 app/templates/components/post-form.hbs
@@ -1,4 +1,9 @@
import Component from '@ember/component';

export default Component.extend({
actions: {
submitForm() {
this.submitHandler();
}
}
});
@@ -8,5 +8,5 @@
<textarea class="js-post-form-body" />
</div>

<button type="button" class="js-post-form-save">Save</button>
<button type="button" class="js-post-form-save" onclick={{action "submitForm"}}>Save</button>
</form>

0 comments on commit 4569527

Please sign in to comment.