ember-testing-guide
ember-testing-guide copied to clipboard
Testing Mixins in controllers
Could we provide description of how to test mixins in controllers? Mixins are often used in big apps so I think It's important to test it. For example:
test('it changes page to first after choosing query', function(assert) {
const searchController = Controller.extend(Paginated, {
previousQuery: ''
}).create();
const mockParachuteObject = {
changes: {
q: 'test',
page: 10
}
};
searchController.setFirstPage(mockParachuteObject);
assert.equal(searchController.page, 1);
});