Debian Codegraph @

packages/popper/tests/unit/getStyleComputedProperty.js

raw
1 import chai from 'chai';
2 const { expect } = chai;
3 import getStyleComputedProperty from '../../src/utils/getStyleComputedProperty';
4
5 describe('utils/getStyleComputedProperty', () => {
6 let node;
7
8 beforeEach(() => {
9 node = document.createElement('div');
10 document.body.appendChild(node);
11 node.style.position = 'relative';
12 });
13
14 it('should return css properties', () => {
15 expect(getStyleComputedProperty(node)).to.deep.equal(
16 window.getComputedStyle(node, null)
17 );
18 });
19
20 it('should return one css property', () => {
21 expect(getStyleComputedProperty(node, 'position')).to.equal('relative');
22 });
23
24 it('should return an empty array from the shadowRoot', () => {
25 let root;
26 if (node.attachShadow) {
27 root = node.attachShadow({ mode: 'open' });
28 expect(getStyleComputedProperty(root)).to.deep.equal([]);
29 }
30 });
31 });