2017-05-03 91 views
0

我有一个测试套件是这样的:如何测试Polymer dom属性?

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()

我怎样才能得到比较属性,或者是有另一种方式来测试invalidpaper-input的属性?

在此先感谢。

回答

0

我找到了答案:

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