【问题标题】:How to assert css property with chai [duplicate]如何用 chai 断言 css 属性 [重复]
【发布时间】:2019-07-11 00:16:16
【问题描述】:

如何使用 mocha/chai 检查元素 cssProperty 是否为 x?

这就是我想要的:

expect(accountText.getCssProperty('color')).to.be('#fff');

这是我得到的错误信息:

expect(...).to.be is not a function

【问题讨论】:

  • 试试等于expect(accountText.getCssProperty('color')).to.equal('#fff');
  • 看起来像 getCssProperty 来查看选择器的值。这有效:expect(accountText.value.getCssProperty('color')).to.be('#fff');

标签: javascript mocha.js chai


【解决方案1】:

试试看:

expect(accountText.getCssProperty('color').value).to.be.equal('#fff');

【讨论】:

  • 嗨,Evgeny。请您解释一下为什么这解决了“不是函数”错误以帮助原始发布者。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-10-02
  • 1970-01-01
  • 2018-06-26
  • 2020-02-26
  • 2014-07-09
  • 1970-01-01
  • 2020-10-27
相关资源
最近更新 更多