forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchai-jquery-tests.ts
91 lines (70 loc) · 1.85 KB
/
chai-jquery-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/// <reference path="../chai/chai.d.ts" />
/// <reference path="chai-jquery.d.ts" />
// tests taken from https://github.com/chaijs/chai-jquery
declare var $;
var expect = chai.expect;
function test_attr() {
expect($('#foo')).to.have.attr('id');
expect($('#foo')).to.have.attr('class', 'container');
}
function test_css() {
expect($('#foo')).to.have.css('color');
expect($('#foo')).to.have.css('font-family', 'serif');
}
function test_data() {
expect($('#foo')).to.have.data('toggle');
expect($('#foo')).to.have.css('toggle', 'true');
expect($('body')).to.have.css('font-family').match(/sans-serif/);
}
function test_class() {
expect($('#foo')).to.have.class('container');
}
function test_id() {
expect($('#foo')).to.have.id('foo');
}
function test_html() {
expect($('#foo')).to.have.html('<div>bar</div>');
}
function test_text() {
expect($('#foo')).to.have.text('bar');
}
function test_value() {
expect($('#foo')).to.have.value('bar');
}
function test_visible() {
expect($('#foo')).to.be.visible;
}
function test_hidden() {
expect($('#foo')).to.be.hidden;
}
function test_selected() {
expect($('#foo')).to.be.selected;
}
function test_checked() {
expect($('#foo')).to.be.checked;
}
function test_disabled() {
expect($('#foo')).to.be.disabled;
}
function test_empty() {
$('.empty').should.be.empty;
expect($('body')).not.to.be.empty;
}
function test_exist() {
$('#exists').should.exist;
expect($('#nonexistent')).not.to.exist;
}
function test_match_selector() {
$('input').should.match('#foo');
}
function test_contain() {
$('body').should.contain('text');
expect($('#content')).to.contain('text');
}
function test_be_selector() {
expect($('#foo')).to.be(':empty');
}
function test_have_selector() {
$('body').should.have('h1');
expect($('#foo')).to.have('div');
}