如何在单元测试中测试元素是否具有继承的css属性?

时间:2015-08-11 03:15:04

标签: css unit-testing coffeescript sinon

我想测试这个按钮在某些条件下是否可见

enter image description here

这是我在单元测试中的coffeescript代码

    expect(@view.$send).to.have.css 'display', 'block'

测试失败,因为该值为空字符串。以下是错误消息:

  1) View should enable "Send" button on successful request:
     AssertionError: expected { Object (0, length, ...) } to have a 'display' CSS property with the value 'block', but the value was ''
      at file:///Users/akong/project/TestView.spec.js:83

我想这是因为'display'属性是继承的,如下所示:

enter image description here

如何成功测试此按钮是否可见?

0 个答案:

没有答案