ember-testing-guide icon indicating copy to clipboard operation
ember-testing-guide copied to clipboard

Testing Mixins in controllers

Open RobertMrowiec opened this issue 5 years ago • 0 comments

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);
  });

RobertMrowiec avatar Jun 06 '19 09:06 RobertMrowiec