gpt4 book ai didi

css - 如何在单元测试中检查css

转载 作者:行者123 更新时间:2023-11-28 09:45:56 26 4
gpt4 key购买 nike

 describe('Link', () => {

makeElement = () => {

let element = angular.element('<textarea id="addnote" vnc-auto-resize style="height: 0px"></textarea>');
_$compile_(element)($rootScope);
return element;
};
// Link specs
it('height should be define and enable', () => {
let element = makeElement();
expect(element).to.have.height(30px');
});

});

此返回高度错误。如何在单元测试中检查高度?

最佳答案

我认为你必须尝试使用​​ chai-jquery

请使用 npm install chai-jquery --save 安装

并将您的代码更改为

expect(element).to.have.css('height', 30'px');

谢谢

关于css - 如何在单元测试中检查css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33933866/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com