Skip to content
Permalink
Browse files

Specify the component should call the save action

We reproduce the acceptance test error at the component level:

Inner Red: Expected submit handler to be called

Our code doesn't refer to this submitHandler attribute yet, so it's never called.
  • Loading branch information...
CodingItWrong committed Jan 11, 2018
1 parent 0e0676c commit 3afe801be10d45ff320e0e7875d778a937960663
Showing with 15 additions and 1 deletion.
  1. +15 −1 tests/integration/components/post-form-test.js
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { render, click } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | post-form', function(hooks) {
@@ -12,4 +12,18 @@ module('Integration | Component | post-form', function(hooks) {
assert.dom('.js-post-form-title').exists();
assert.dom('.js-post-form-body').exists();
});

test('it calls the submit handler', async function(assert) {
let submitHandlerCalled = false;
this.set('testSubmitHandler', () => {
submitHandlerCalled = true;
});

await render(hbs`{{post-form submitHandler=(action testSubmitHandler)}}`);

await click('.js-post-form-save');

assert.ok(submitHandlerCalled,
"Expected submit handler to be called");
});
});

0 comments on commit 3afe801

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