Chai-jQuery Flashcards

These chainers are available when asserting about a DOM object.

1
Q

attr(name, [value])

A

expect($el).to.have.attr(‘foo’, ‘bar’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

prop(name, [value])

A

expect($el).to.have.prop(‘disabled’, false)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

css(name, [value])

A

expect($el).to.have.css(‘background-color’, ‘rgb(0, 0, 0)’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

data(name, [value])

A

expect($el).to.have.data(‘foo’, ‘bar’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

class(className)

A

expect($el).to.have.class(‘foo’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

id(id)

A

expect($el).to.have.id(‘foo’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

html(html)

A

expect($el).to.have.html(‘I love testing’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

text(text)

A

expect($el).to.have.text(‘I love testing’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

value(value)

A

expect($el).to.have.value(‘test@dev.com’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

visible

A

expect($el).to.be.visible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

hidden

A

expect($el).to.be.hidden

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

selected

A

expect($option).not.to.be.selected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

checked

A

expect($input).not.to.be.checked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

focus[ed]

A

expect($input).not.to.be.focused

expect($input).to.have.focus

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

enabled

A

expect($input).to.be.enabled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

disabled

A

expect($input).to.be.disabled

17
Q

empty

A

expect($el).not.to.be.empty

18
Q

exist

A

expect($nonexistent).not.to.exist

19
Q

match(selector)

A

expect($emptyEl).to.match(‘:empty’)

20
Q

contain(text)

A

expect($el).to.contain(‘text’)

21
Q

descendants(selector)

A

expect($el).to.have.descendants(‘div’)