diff --git a/.all-contributorsrc b/.all-contributorsrc index b6dc27ef..e3fe1602 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -623,6 +623,42 @@ "code", "test" ] + }, + { + "login": "icecream17", + "name": "steven nguyen", + "avatar_url": "https://avatars.githubusercontent.com/u/58114641?v=4", + "profile": "http://lichess.org/@/StevenEmily", + "contributions": [ + "doc" + ] + }, + { + "login": "tu4mo", + "name": "tu4mo", + "avatar_url": "https://avatars.githubusercontent.com/u/16735302?v=4", + "profile": "http://tu4mo.com", + "contributions": [ + "doc" + ] + }, + { + "login": "MatanBobi", + "name": "Matan Borenkraout", + "avatar_url": "https://avatars.githubusercontent.com/u/12711091?v=4", + "profile": "https://matan.io", + "contributions": [ + "platform" + ] + }, + { + "login": "yannbf", + "name": "Yann Braga", + "avatar_url": "https://avatars.githubusercontent.com/u/1671563?v=4", + "profile": "https://github.com/yannbf", + "contributions": [ + "code" + ] } ], "repoHost": "https://github.com", diff --git a/.npmrc b/.npmrc index d2722898..1df2a6d8 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ -registry=http://registry.npmjs.org/ +registry=https://registry.npmjs.org/ package-lock=false diff --git a/README.md b/README.md index 0ccd2d74..074152f0 100644 --- a/README.md +++ b/README.md @@ -509,7 +509,7 @@ expect(getByTestId('parent')).toContainHTML('') toHaveAccessibleDescription(expectedAccessibleDescription?: string | RegExp) ``` -This allows to assert that an element has the expected +This allows you to assert that an element has the expected [accessible description](https://w3c.github.io/accname/). You can pass the exact string of the expected accessible description, or you can @@ -557,7 +557,7 @@ expect(getByTestId('logo')).toHaveAccessibleDescription( toHaveAccessibleName(expectedAccessibleName?: string | RegExp) ``` -This allows to assert that an element is has the expected +This allows you to assert that an element has the expected [accessible name](https://w3c.github.io/accname/). It is useful, for instance, to assert that form elements and buttons are properly labelled. @@ -1068,7 +1068,7 @@ This allows you to check whether the given element has an Use the `aria-errormessage` attribute to reference another element that contains custom error message text. Multiple ids is **NOT** allowed. Authors MUST use -`aria-invalid` in conjunction with `aria-errormessage`. Leran more from +`aria-invalid` in conjunction with `aria-errormessage`. Learn more from [`aria-errormessage` spec](https://www.w3.org/TR/wai-aria/#aria-errormessage). Whitespace is normalized. @@ -1350,6 +1350,12 @@ Thanks goes to these people ([emoji key][emojis]):
Marcel Barner

💻 ⚠️
Doma

💻 ⚠️
Julien Wajsberg

💻 ⚠️ +
steven nguyen

📖 + + +
tu4mo

📖 +
Matan Borenkraout

📦 +
Yann Braga

💻 diff --git a/package.json b/package.json index 816ace83..5045a5d0 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,13 @@ "jest-environment-jsdom-sixteen": "^1.0.3", "jest-watch-select-projects": "^2.0.0", "jsdom": "^16.2.1", - "kcd-scripts": "^5.6.0", + "kcd-scripts": "^11.1.0", "pretty-format": "^25.1.0" }, "eslintConfig": { "extends": "./node_modules/kcd-scripts/eslint.js", "rules": { - "babel/no-invalid-this": "off" + "@babel/no-invalid-this": "off" }, "overrides": [ { diff --git a/src/__tests__/to-contain-html.js b/src/__tests__/to-contain-html.js index d4ad11ea..6bfd95e4 100644 --- a/src/__tests__/to-contain-html.js +++ b/src/__tests__/to-contain-html.js @@ -102,11 +102,11 @@ describe('.toContainHTML', () => { } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).toContainHTML() - Expected: -
non-existant element
- Received: - " - `) +expect(element).toContainHTML() +Expected: +
non-existant element
+Received: + +`) }) }) diff --git a/src/__tests__/to-have-display-value.js b/src/__tests__/to-have-display-value.js index 05ac73e7..c018ab7c 100644 --- a/src/__tests__/to-have-display-value.js +++ b/src/__tests__/to-have-display-value.js @@ -129,7 +129,7 @@ test('it should throw if element is not valid', () => { } expect(errorMessage).toMatchInlineSnapshot( - `".toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead."`, + `.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.`, ) try { @@ -139,7 +139,7 @@ test('it should throw if element is not valid', () => { } expect(errorMessage).toMatchInlineSnapshot( - `".toHaveDisplayValue() currently does not support input[type=\\"radio\\"], try with another matcher instead."`, + `.toHaveDisplayValue() currently does not support input[type="radio"], try with another matcher instead.`, ) try { @@ -149,7 +149,7 @@ test('it should throw if element is not valid', () => { } expect(errorMessage).toMatchInlineSnapshot( - `".toHaveDisplayValue() currently does not support input[type=\\"checkbox\\"], try with another matcher instead."`, + `.toHaveDisplayValue() currently does not support input[type="checkbox"], try with another matcher instead.`, ) }) diff --git a/src/__tests__/to-have-value.js b/src/__tests__/to-have-value.js index d0159361..80cc7828 100644 --- a/src/__tests__/to-have-value.js +++ b/src/__tests__/to-have-value.js @@ -115,13 +115,13 @@ describe('.toHaveValue', () => { } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).toHaveValue(something else) +expect(element).toHaveValue(something else) - Expected the element to have value: - something else - Received: - foo" - `) +Expected the element to have value: + something else +Received: + foo +`) }) test('throws with type information when the expected text input value has loose equality with received value', () => { @@ -135,13 +135,13 @@ describe('.toHaveValue', () => { } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).toHaveValue(8) +expect(element).toHaveValue(8) - Expected the element to have value: - 8 (number) - Received: - 8 (string)" - `) +Expected the element to have value: + 8 (number) +Received: + 8 (string) +`) }) test('throws when using not but the expected input value does match', () => { @@ -155,13 +155,13 @@ describe('.toHaveValue', () => { errorMessage = error.message } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).not.toHaveValue(foo) +expect(element).not.toHaveValue(foo) - Expected the element not to have value: - foo - Received: - foo" - `) +Expected the element not to have value: + foo +Received: + foo +`) }) test('throws when the form has no a value but a value is expected', () => { @@ -175,13 +175,13 @@ describe('.toHaveValue', () => { errorMessage = error.message } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).toHaveValue(expected) +expect(element).toHaveValue(expected) - Expected the element to have value: - (any) - Received: - " - `) +Expected the element to have value: + (any) +Received: + +`) }) test('throws when the form has a value but none is expected', () => { @@ -195,12 +195,12 @@ describe('.toHaveValue', () => { errorMessage = error.message } expect(errorMessage).toMatchInlineSnapshot(` - "expect(element).not.toHaveValue(expected) +expect(element).not.toHaveValue(expected) - Expected the element not to have value: - (any) - Received: - foo" - `) +Expected the element not to have value: + (any) +Received: + foo +`) }) }) diff --git a/src/to-be-in-the-document.js b/src/to-be-in-the-document.js index 765b3cf5..8ccc451a 100644 --- a/src/to-be-in-the-document.js +++ b/src/to-be-in-the-document.js @@ -29,7 +29,7 @@ export function toBeInTheDocument(element) { '', ), '', - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap this.utils.RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()), ].join('\n') }, diff --git a/src/to-contain-element.js b/src/to-contain-element.js index 93cc8818..c94ddbf9 100644 --- a/src/to-contain-element.js +++ b/src/to-contain-element.js @@ -17,7 +17,7 @@ export function toContainElement(container, element) { 'element', ), '', - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap this.utils.RECEIVED_COLOR(`${this.utils.stringify( container.cloneNode(false), )} ${ diff --git a/src/to-contain-html.js b/src/to-contain-html.js index 714048ca..ccbff5f5 100644 --- a/src/to-contain-html.js +++ b/src/to-contain-html.js @@ -23,7 +23,7 @@ export function toContainHTML(container, htmlText) { '', ), 'Expected:', - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap ` ${this.utils.EXPECTED_COLOR(htmlText)}`, 'Received:', ` ${this.utils.printReceived(container.cloneNode(true))}`, diff --git a/src/utils.js b/src/utils.js index ba38629e..2f07fb8e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,5 +1,5 @@ import redent from 'redent' -import {parse} from 'css' +import cssParse from 'css/lib/parse' import isEqual from 'lodash/isEqual' class GenericTypeError extends Error { @@ -28,7 +28,7 @@ class GenericTypeError extends Error { '', ), '', - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap `${context.utils.RECEIVED_COLOR( 'received', )} value must ${expectedString}.`, @@ -91,16 +91,16 @@ class InvalidCSSError extends Error { this.message = [ received.message, '', - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap context.utils.RECEIVED_COLOR(`Failing css:`), - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap context.utils.RECEIVED_COLOR(`${received.css}`), ].join('\n') } } function parseCSS(css, ...args) { - const ast = parse(`selector { ${css} }`, {silent: true}).stylesheet + const ast = cssParse(`selector { ${css} }`, {silent: true}).stylesheet if (ast.parsingErrors && ast.parsingErrors.length > 0) { const {reason, line} = ast.parsingErrors[0] @@ -137,11 +137,11 @@ function getMessage( ) { return [ `${matcher}\n`, - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap `${expectedLabel}:\n${context.utils.EXPECTED_COLOR( redent(display(context, expectedValue), 2), )}`, - // eslint-disable-next-line babel/new-cap + // eslint-disable-next-line @babel/new-cap `${receivedLabel}:\n${context.utils.RECEIVED_COLOR( redent(display(context, receivedValue), 2), )}`,