mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Fix chai-jquery tests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
/// <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;
|
||||
|
||||
@@ -17,6 +19,7 @@ function test_css() {
|
||||
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() {
|
||||
@@ -59,10 +62,30 @@ 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');
|
||||
}
|
||||
20
chai/chai.d.ts
vendored
20
chai/chai.d.ts
vendored
@@ -12,7 +12,25 @@ declare module chai {
|
||||
(target: any): Expect;
|
||||
}
|
||||
|
||||
interface Expect extends LanguageChains, NumericComparison, TypeComparison {
|
||||
interface Assertions {
|
||||
attr(name, value?);
|
||||
css(name, value?);
|
||||
data(name, value?);
|
||||
class(className);
|
||||
id(id);
|
||||
html(html);
|
||||
text(text);
|
||||
value(value);
|
||||
visible;
|
||||
hidden;
|
||||
selected;
|
||||
checked;
|
||||
disabled;
|
||||
empty;
|
||||
exist;
|
||||
}
|
||||
|
||||
interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions {
|
||||
not: Expect;
|
||||
deep: Deep;
|
||||
a: TypeComparison;
|
||||
|
||||
Reference in New Issue
Block a user