ember-basic-dropdown icon indicating copy to clipboard operation
ember-basic-dropdown copied to clipboard

Cannot read property 'id' of null (destination)

Open cameronblandford opened this issue 7 years ago • 4 comments

Hey there - when running in a test environment, this bit of code is run to find the right destination:

     _getDestinationId: function _getDestinationId() {
      var config = Ember.getOwner(this).resolveRegistration('config:environment');
      if (config.environment === 'test') {
        return document.querySelector('#ember-testing > .ember-view').id;
      }
      return config['ember-basic-dropdown'] && config['ember-basic-dropdown'].destination || 'ember-basic-dropdown-wormhole';
    }

The problem is that #ember-testing > .ember-view is consistently returning null, since there's no .ember-view div present. Looks like it's breaking every acceptance test that navigates to a route containing an instance of the dropdown.

cameronblandford avatar May 07 '18 20:05 cameronblandford

I was able to fix the problem by changing the method from selecting #ember-testing > .ember-view to just #ember-testing. My guess is that this is an ember 3 thing?

cameronblandford avatar May 07 '18 22:05 cameronblandford

@cameronblandford

I got error like you. can you share how to fix this error ???

stepanushariara avatar Aug 23 '18 12:08 stepanushariara

Same issue.

Not sure what error you are encountering but I had accidentally removed these two lines from the config/environments.js file. After reverting everything worked fine again.

if (environment === 'test') {
     ENV.APP.rootElement = '#ember-testing';
     ENV.APP.autoboot = false;
}

I am running Ember 3.3

wynnfarm avatar Sep 04 '18 20:09 wynnfarm

Same issue, Ember: 2.9.1

luis-carlos-campos avatar Oct 29 '18 13:10 luis-carlos-campos

Closing this old issue as the mentioned code part was changed in newer versions and the initial issue was reported on a old, not anymore supported ember version

mkszepp avatar Mar 16 '24 11:03 mkszepp