From fb647dc6111717a75d955c00aa7a6840a6e44a67 Mon Sep 17 00:00:00 2001 From: Thomas Allmer Date: Fri, 3 Apr 2020 19:27:58 +0200 Subject: [PATCH] fix(chai-dom): add missing visible assertion (#43584) --- types/chai-dom/chai-dom-tests.ts | 5 ++--- types/chai-dom/index.d.ts | 18 ++++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/types/chai-dom/chai-dom-tests.ts b/types/chai-dom/chai-dom-tests.ts index ef8a9bb385..75afa37fc5 100644 --- a/types/chai-dom/chai-dom-tests.ts +++ b/types/chai-dom/chai-dom-tests.ts @@ -5,7 +5,6 @@ chai.use(chaiDom); var expect = chai.expect; function test() { - var testElement = '
'; expect(testElement).to.have.attribute('foo', 'bar'); expect(testElement).to.have.attr('foo').match(/bar/); @@ -22,5 +21,5 @@ function test() { expect(testElement).to.match('foo'); expect(testElement).to.contain('foo'); expect(testElement).to.contain(document.body); - -} \ No newline at end of file + expect(testElement).to.be.visible; +} diff --git a/types/chai-dom/index.d.ts b/types/chai-dom/index.d.ts index 5f75de46f8..41855b2f9d 100644 --- a/types/chai-dom/index.d.ts +++ b/types/chai-dom/index.d.ts @@ -7,9 +7,7 @@ /// declare namespace Chai { - interface Assertion { - attr(name: string, value?: string): Assertion; attribute(name: string, value?: string): Assertion; @@ -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; @@ -30,7 +28,7 @@ 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; @@ -38,25 +36,21 @@ declare namespace Chai { 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; }