Skip to content

Testing Mixins in controllers #12

@RobertMrowiec

Description

@RobertMrowiec

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions