Chai-jQuery Flashcards
These chainers are available when asserting about a DOM object.
attr(name, [value])
expect($el).to.have.attr(‘foo’, ‘bar’)
prop(name, [value])
expect($el).to.have.prop(‘disabled’, false)
css(name, [value])
expect($el).to.have.css(‘background-color’, ‘rgb(0, 0, 0)’)
data(name, [value])
expect($el).to.have.data(‘foo’, ‘bar’)
class(className)
expect($el).to.have.class(‘foo’)
id(id)
expect($el).to.have.id(‘foo’)
html(html)
expect($el).to.have.html(‘I love testing’)
text(text)
expect($el).to.have.text(‘I love testing’)
value(value)
expect($el).to.have.value(‘test@dev.com’)
visible
expect($el).to.be.visible
hidden
expect($el).to.be.hidden
selected
expect($option).not.to.be.selected
checked
expect($input).not.to.be.checked
focus[ed]
expect($input).not.to.be.focused
expect($input).to.have.focus
enabled
expect($input).to.be.enabled