Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ember-cli-addon-docs includes ember-modal-dialog and interferes with documented addon #429

Open
psbanka opened this issue Dec 6, 2019 · 2 comments

Comments

@psbanka
Copy link
Contributor

psbanka commented Dec 6, 2019

Hi, there. I have an addon which uses and extends ember-modal-dialog . However, when running tests of our addon, the test suddenly fail after adding ember-cli-addon-docs. Specifically, the dialog no longer inserts its overlay (and our tests verify this). This appears to be due to the fact that ember-cli-addon-docs extends the default dialog in this file: addon/components/modal-dialog/component.js therefore, our unit-tests fail because we are in a testing mode.

export default ModalDialog.extend({
  renderInPlace: computed(function() {
    let config = getOwner(this).resolveRegistration('config:environment')
    return config.environment === 'test';
  })
});

How should we proceed? We do not want to change our tests, because clearly this will be testing the wrong thing. Is there a reason why this has to be in place for ember-cli-addon-docs ?

@psbanka
Copy link
Contributor Author

psbanka commented Dec 9, 2019

I was able to work around this by creating addon/components/our-modal-dialog.js as

import ModalDialog from 'ember-modal-dialog/components/modal-dialog'

export default ModalDialog.extend({
  renderInPlace: false,
})

and changing all references to modal-dialog elsewhere in the addon to our-modal-dialog. It would seem that a better approach would be to have ember-cli-addon-docs re-export its version of modal-dialog as a different name so as to avoid colliding with dialogs in an addon when testing.

@RobbieTheWagner
Copy link
Member

@psbanka that seems like a logical solution. Would you be interested in opening a PR for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants