Skip to content
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 3afe801 commit d1f12d7c7d8e947dbde6937a2a6a54ec51c359d0
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() {
@@ -8,5 +8,5 @@
<textarea class="js-post-form-body" />

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

0 comments on commit d1f12d7

Please sign in to comment.
You can’t perform that action at this time.