From 562d2b92a142d79526deb96cfdd8fea27168a576 Mon Sep 17 00:00:00 2001 From: Leandro Lourenci Date: Fri, 31 Jan 2020 19:33:49 -0300 Subject: [PATCH 1/2] Update jest-dom's types --- types/testing-library__jest-dom/index.d.ts | 2 +- .../test/testing-library__jest-dom-global-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/testing-library__jest-dom/index.d.ts b/types/testing-library__jest-dom/index.d.ts index a6db284e9af8f0..e1aba35d7fe1ef 100644 --- a/types/testing-library__jest-dom/index.d.ts +++ b/types/testing-library__jest-dom/index.d.ts @@ -28,7 +28,7 @@ declare namespace jest { toHaveClass(...classNames: string[]): R; toHaveFocus(): R; toHaveFormValues(expectedValues: Record): R; - toHaveStyle(css: string): R; + toHaveStyle(css: string | object): R; toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R; toHaveValue(value?: string | string[] | number): R; toBeChecked(): R; diff --git a/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts b/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts index 8dc0e3c1378aa3..4455ec71338c25 100644 --- a/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts +++ b/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts @@ -22,6 +22,7 @@ expect(element).toHaveClass('cls1', 'cls2', 'cls3', 'cls4'); expect(element).toHaveFocus(); expect(element).toHaveFormValues({ foo: 'bar', baz: 1 }); expect(element).toHaveStyle('display: block'); +expect(element).toHaveStyle({ display: 'block' }); expect(element).toHaveTextContent('Text'); expect(element).toHaveTextContent(/Text/); expect(element).toHaveTextContent('Text', { normalizeWhitespace: true }); From 174647e04da8663395446051690564bd2ec7531f Mon Sep 17 00:00:00 2001 From: Leandro Lourenci Date: Fri, 31 Jan 2020 21:18:42 -0300 Subject: [PATCH 2/2] Apply suggestions from review --- types/testing-library__jest-dom/index.d.ts | 2 +- .../test/testing-library__jest-dom-global-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/testing-library__jest-dom/index.d.ts b/types/testing-library__jest-dom/index.d.ts index e1aba35d7fe1ef..c56eaf7752333e 100644 --- a/types/testing-library__jest-dom/index.d.ts +++ b/types/testing-library__jest-dom/index.d.ts @@ -28,7 +28,7 @@ declare namespace jest { toHaveClass(...classNames: string[]): R; toHaveFocus(): R; toHaveFormValues(expectedValues: Record): R; - toHaveStyle(css: string | object): R; + toHaveStyle(css: string | Record): R; toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R; toHaveValue(value?: string | string[] | number): R; toBeChecked(): R; diff --git a/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts b/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts index 4455ec71338c25..94b304eda689cf 100644 --- a/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts +++ b/types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts @@ -22,7 +22,7 @@ expect(element).toHaveClass('cls1', 'cls2', 'cls3', 'cls4'); expect(element).toHaveFocus(); expect(element).toHaveFormValues({ foo: 'bar', baz: 1 }); expect(element).toHaveStyle('display: block'); -expect(element).toHaveStyle({ display: 'block' }); +expect(element).toHaveStyle({ display: 'block', width: 100 }); expect(element).toHaveTextContent('Text'); expect(element).toHaveTextContent(/Text/); expect(element).toHaveTextContent('Text', { normalizeWhitespace: true });