dimanche 15 juillet 2018

Ember Responsive: cannot get setBreakpoint() acceptance test helper to work

Attempting to use the Ember Responsive add-on to add breakpoints to my acceptance test. I think I'm setting everything up right, and the breakpoints work fine in my handlebar templates, but I'm getting a weird error when running my test. Here is the error:

Error: Could not find module `ember-responsive/media` imported from `{my_repo}/tests/helpers/responsive`

TypeError: Cannot read property 'exports' of undefined

I'm using the beta version (as specified in my package.json):

    "ember-responsive": "^3.0.0-beta.3",

I'm importing the helper into my start-app.js:

import './responsive';

And in my testing file, I import setBreakpoint as follows:

import { setBreakpoint } from 'ember-responsive/test-support';

Here's my failing test:

test('menu icon appears on mobile', function(assert)  {
  assert.expect(1);

  setBreakpoint('mobile');
  visit('/home');

  andThen(function() {
    assert.equal(find('#menu .app-menu .menu-icon').length, 1);
  });

});

:( :( :( Any ideas? I had to upgrade ember-responsive from v.2 so maybe I did something wrong? I just uninstalled using npm and then reinstalled.




Aucun commentaire:

Enregistrer un commentaire