ember-tether icon indicating copy to clipboard operation
ember-tether copied to clipboard

Static positioning the testing container does not work.

Open ghost opened this issue 9 years ago • 0 comments

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

ghost avatar May 12 '16 09:05 ghost