ungleich-staticcms/assets/u/static/popper.js-1.16.0/packages/popper/tests/unit/getStyleComputedProperty.js
Nico Schottelius 16fb2bb919 import popper.js
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
2019-12-31 01:21:21 +01:00

31 lines
869 B
JavaScript

import chai from 'chai';
const { expect } = chai;
import getStyleComputedProperty from '../../src/utils/getStyleComputedProperty';
describe('utils/getStyleComputedProperty', () => {
let node;
beforeEach(() => {
node = document.createElement('div');
document.body.appendChild(node);
node.style.position = 'relative';
});
it('should return css properties', () => {
expect(getStyleComputedProperty(node)).to.deep.equal(
window.getComputedStyle(node, null)
);
});
it('should return one css property', () => {
expect(getStyleComputedProperty(node, 'position')).to.equal('relative');
});
it('should return an empty array from the shadowRoot', () => {
let root;
if (node.attachShadow) {
root = node.attachShadow({ mode: 'open' });
expect(getStyleComputedProperty(root)).to.deep.equal([]);
}
});
});