Skip to content

Commit

Permalink
fix(chai-dom): add missing visible assertion (DefinitelyTyped#43584)
Browse files Browse the repository at this point in the history
  • Loading branch information
daKmoR authored Apr 3, 2020
1 parent 28ac633 commit fb647dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
5 changes: 2 additions & 3 deletions types/chai-dom/chai-dom-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ chai.use(chaiDom);
var expect = chai.expect;

function test() {

var testElement = '<div></div>';
expect(testElement).to.have.attribute('foo', 'bar');
expect(testElement).to.have.attr('foo').match(/bar/);
Expand All @@ -22,5 +21,5 @@ function test() {
expect(testElement).to.match('foo');
expect(testElement).to.contain('foo');
expect(testElement).to.contain(document.body);

}
expect(testElement).to.be.visible;
}
18 changes: 6 additions & 12 deletions types/chai-dom/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
/// <reference types="chai" />

declare namespace Chai {

interface Assertion {

attr(name: string, value?: string): Assertion;

attribute(name: string, value?: string): Assertion;
Expand All @@ -20,7 +18,7 @@ declare namespace Chai {

html(html: string): Assertion;

text(text: string|string[]): Assertion;
text(text: string | string[]): Assertion;

value(text: string): Assertion;

Expand All @@ -30,33 +28,29 @@ declare namespace Chai {
// same type or a more general type, so don't need to be re-declared even though
// the implementation is different

descendant(element: string|HTMLElement): Assertion;
descendant(element: string | HTMLElement): Assertion;

descendants(selector: string): Assertion;

displayed: Assertion;

trimmed: Assertion;

visible: Assertion;
}

interface Include {
text(text: string | string[]): Assertion;

text(text: string|string[]): Assertion;

html(text: string|string[]): Assertion;

html(text: string | string[]): Assertion;
}

interface Match {

(selector: string): Assertion;

}

}

declare module "chai-dom" {
declare module 'chai-dom' {
const chaiDom: Chai.ChaiPlugin;
export = chaiDom;
}

0 comments on commit fb647dc

Please sign in to comment.