我正在使用 JestJS (npm jest-cli)构建单元测试,并且需要验证 ReactJS 元素是否包含我正在寻找的 CSS 样式。
我试着检查
it('should highlight the selected option in the drop-down list', function() {
var iconTriangleDown = TestUtils.findRenderedDOMComponentWithClass(dropList, 'icon-triangle-down');
var iconHeight = window.getComputedStyle(iconTriangleDown.getDOMNode(), null).height;
expect(iconHeight).notToEqual('');
});
这导致 iconHeight === '' 而不是像素值。
我想知道窗口是否被 Jest 嘲笑。或者如果不支持窗口。