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

Static positioning the testing container does not work. #33

Open
ghost opened this issue May 12, 2016 · 0 comments
Open

Static positioning the testing container does not work. #33

ghost opened this issue May 12, 2016 · 0 comments

Comments

@ghost
Copy link

ghost commented May 12, 2016

You actually need to apply static positioning to all elements between the element that tether positions and the body.

This is how I currently manage to make it work, it's a bit of a brute force fix, but atleast it works.

// Set position static to short-circuit Hubspot Tether's positioning
// https://github.com/HubSpot/tether/pull/98/
const FIX_ELEMENT_ID = 'tether_fix_style_element';

export function insertTetherFix() {
  let styleElement = document.createElement('style');
  styleElement.id = FIX_ELEMENT_ID;
  styleElement.innerText =
    '#ember-testing-container, #ember-testing-container * {' +
      'position: static !important;' +
    '}';

  document.body.appendChild(styleElement);
}

export function removeTetherFix() {
  let styleElement = document.getElementById(FIX_ELEMENT_ID);
  document.body.removeChild(styleElement);
}

then:

test('test something', function(assert) {
   insertTetherFix();

  // test something

  andThen(() => removeTetherFix());
});
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

0 participants