【问题标题】:How to test Polymer dom attribute?如何测试 Polymer dom 属性?
【发布时间】:2017-05-03 23:20:53
【问题描述】:

我有一个这样的测试套件:

setup(function() {
  form = fixture('basic');
});

test('hide and show error message', function() {
  title = Polymer.dom(form.root).querySelector('#title');
  save = Polymer.dom(form.root).querySelector('#save');

  expect(Polymer.dom(title).hasAttribute('invalid')).to.be.false;
  MockInteractions.tap(save);
  expect(Polymer.dom(title).hasAttribute('invalid')).to.be.true;
});

当然,Polymer.dom(...) 没有功能 hasAttribute()

如何获取要比较的属性,或者有其他方法可以测试paper-inputinvalid 属性吗?

提前致谢。

【问题讨论】:

    标签: javascript polymer


    【解决方案1】:

    我找到了答案:

    expect(title.inputElement.invalid).to.be.false;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-07
      相关资源
      最近更新 更多