Acceptance tests generally help test workflows and emulate user interactions. In this recipe, we'll look at creating a few simple acceptance tests.
In a new application, create a new component called
book-shelf
and a new acceptance test calledadd-book-test.js
:$ ember g component book-shelf $ ember g acceptance-test add-book
This will create the code necessary for the
book-shelf
component and theadd-book
acceptance test. Keep in mind that an integration test will also be generated for thebook-shelf
component. We will not be updating the integration test in this example.Update the component file with a new
books
array and new action:// app/components/book-shelf.js import Ember from 'ember'; export default Ember.Component.extend({ books: Ember.A([{name: 'Moby Dick'}]), actions: { add(val) { this.get('books').addObject({name:val}); } } });
This component uses the
books
property to keep track of books on the book shelf...