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

Integration test failing #29

Open
brancusi opened this issue Apr 25, 2016 · 2 comments
Open

Integration test failing #29

brancusi opened this issue Apr 25, 2016 · 2 comments

Comments

@brancusi
Copy link

Hi,

When using this component as part of another component, the integration for the parent component is failing.

Error: ember-wormhole failed to render content because the
destinationElementId was set to an undefined or falsy value.

Any ideas on how to get around this?

Maybe related to: yapplabs/ember-wormhole#25

@alexander-alvarez
Copy link

alexander-alvarez commented May 18, 2016

I made a helper to facilitate this which I call in beforeEach, and pass this to

/**
 *  Helper to initialize ember-modal-dialog correctly for tests
 *
 * @param self: `this` in a component integration test that uses ember modal dialog
 * @param divId: string representing HTML element ID
 */
export default function(self, divId){
  let modalDialogService = self.container.lookup('service:modal-dialog');
  modalDialogService.destinationElementId = divId || 'ember-testing'; // maybe 'ember-testing-container' is better?
}

I'm still having issues with event delegation not being correct even after the adjustments in https://github.com/yapplabs/ember-tether#acceptance-testing
So any actions within the modal aren't picked up by ember correctly

EDIT: Got around it by extending the TetherDialog component just for the sole purpose of adding these lines and using my wrapped version in my hbs everywhere.

@scottmessinger
Copy link

From what I can tell, ember-tether doesn't have a dependency on ember-wormhole anymore, so setting the destinationElementId won't work. I did find something that worked, though. Tether will move an element if any of the element's parents have a position property not equal to static: https://github.com/HubSpot/tether/blob/4f80b7407b40c08e2ee892b43e996870381bdaaf/src/js/tether.js#L748-L764. Using jQuery, I set the element's ancestors to have a position of static:

// Before tether is activated on the element. E.g if you're using tether for a popover
// run this line before the popover is shown:
this.$('.classname-of-your-tethered-element').parents().css('position', 'static')

// then show the tethered element. In my case, it's something like:
// this.$('.tethered-element-anchor').click()

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

No branches or pull requests

3 participants