From ebe6f6e656e9bdd3a32d4affabe4131f070e1a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Mon, 10 Jun 2019 20:00:00 +0200 Subject: [PATCH 1/9] Update DOM Testing Library --- package-lock.json | 24 +++++++++++++++++++----- package.json | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2c6f66cb..0e3aa9e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1491,12 +1491,13 @@ "integrity": "sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==" }, "@testing-library/dom": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-5.0.1.tgz", - "integrity": "sha512-HmyN4b/PmSaSB1ku0tWjgnTtyrwNBXEpp44wgfNaDhyj6IJTCWp1GAf4AANoLGItgMsYjepwWOdMyuJ/8iyStQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-5.2.0.tgz", + "integrity": "sha512-nFaZes/bzDfMqwZpQXdiPyj3WXU16FYf5k5NCFu/qJM4JdRJLHEtSRYtrETmk7nCf+qLVoHCqRduGi/4KE83Gw==", "requires": { "@babel/runtime": "^7.4.5", "@sheerun/mutationobserver-shim": "^0.3.2", + "aria-query": "3.0.0", "pretty-format": "^24.8.0", "wait-for-expect": "^1.2.0" } @@ -1721,6 +1722,15 @@ "sprintf-js": "~1.0.2" } }, + "aria-query": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", + "integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=", + "requires": { + "ast-types-flow": "0.0.7", + "commander": "^2.11.0" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -1803,6 +1813,11 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=" + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -2541,8 +2556,7 @@ "commander": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", - "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", - "dev": true + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" }, "component-emitter": { "version": "1.3.0", diff --git a/package.json b/package.json index 982c50f2..e69913f4 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "author": "Daniel Cook", "license": "MIT", "dependencies": { - "@testing-library/dom": "^5.0.1", + "@testing-library/dom": "^5.2.0", "@vue/test-utils": "^1.0.0-beta.29", "vue": "^2.6.10", "vue-template-compiler": "^2.6.10" From 069cef6575b050d076a3f606d0f93d6ef9853eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Mon, 10 Jun 2019 20:00:17 +0200 Subject: [PATCH 2/9] Remove unused files --- .../__tests__/components/queries/AltText.vue | 3 --- .../components/queries/Attribute.vue | 5 ----- tests/__tests__/components/queries/Empty.vue | 3 --- .../components/queries/GetByAltText.vue | 6 ----- .../components/queries/JestHelpers.vue | 3 --- .../components/queries/LabelText.vue | 13 ----------- .../queries/LabelWithNoFormControl.vue | 3 --- .../components/queries/Placeholder.vue | 3 --- .../components/queries/TotallyEmptyLabel.vue | 3 --- tests/__tests__/components/queries/index.js | 21 ------------------ .../programmatic-routing/components/About.vue | 3 --- .../programmatic-routing/components/App.vue | 12 ---------- .../programmatic-routing/components/Home.vue | 16 -------------- .../components/LocationDisplay.vue | 3 --- .../components/NoMatch.vue | 3 --- .../router/programmatic-routing/index.js | 22 ------------------- 16 files changed, 122 deletions(-) delete mode 100644 tests/__tests__/components/queries/AltText.vue delete mode 100644 tests/__tests__/components/queries/Attribute.vue delete mode 100644 tests/__tests__/components/queries/Empty.vue delete mode 100644 tests/__tests__/components/queries/GetByAltText.vue delete mode 100644 tests/__tests__/components/queries/JestHelpers.vue delete mode 100644 tests/__tests__/components/queries/LabelText.vue delete mode 100644 tests/__tests__/components/queries/LabelWithNoFormControl.vue delete mode 100644 tests/__tests__/components/queries/Placeholder.vue delete mode 100644 tests/__tests__/components/queries/TotallyEmptyLabel.vue delete mode 100644 tests/__tests__/components/queries/index.js delete mode 100644 tests/__tests__/router/programmatic-routing/components/About.vue delete mode 100644 tests/__tests__/router/programmatic-routing/components/App.vue delete mode 100644 tests/__tests__/router/programmatic-routing/components/Home.vue delete mode 100644 tests/__tests__/router/programmatic-routing/components/LocationDisplay.vue delete mode 100644 tests/__tests__/router/programmatic-routing/components/NoMatch.vue delete mode 100644 tests/__tests__/router/programmatic-routing/index.js diff --git a/tests/__tests__/components/queries/AltText.vue b/tests/__tests__/components/queries/AltText.vue deleted file mode 100644 index 8e08c4cd..00000000 --- a/tests/__tests__/components/queries/AltText.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/Attribute.vue b/tests/__tests__/components/queries/Attribute.vue deleted file mode 100644 index 1197b8fb..00000000 --- a/tests/__tests__/components/queries/Attribute.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/tests/__tests__/components/queries/Empty.vue b/tests/__tests__/components/queries/Empty.vue deleted file mode 100644 index 04d85e1b..00000000 --- a/tests/__tests__/components/queries/Empty.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/GetByAltText.vue b/tests/__tests__/components/queries/GetByAltText.vue deleted file mode 100644 index 33d3f365..00000000 --- a/tests/__tests__/components/queries/GetByAltText.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/tests/__tests__/components/queries/JestHelpers.vue b/tests/__tests__/components/queries/JestHelpers.vue deleted file mode 100644 index 8e08c4cd..00000000 --- a/tests/__tests__/components/queries/JestHelpers.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/LabelText.vue b/tests/__tests__/components/queries/LabelText.vue deleted file mode 100644 index d51363fd..00000000 --- a/tests/__tests__/components/queries/LabelText.vue +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/tests/__tests__/components/queries/LabelWithNoFormControl.vue b/tests/__tests__/components/queries/LabelWithNoFormControl.vue deleted file mode 100644 index 9808ee2f..00000000 --- a/tests/__tests__/components/queries/LabelWithNoFormControl.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/Placeholder.vue b/tests/__tests__/components/queries/Placeholder.vue deleted file mode 100644 index 9e92cb1a..00000000 --- a/tests/__tests__/components/queries/Placeholder.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/TotallyEmptyLabel.vue b/tests/__tests__/components/queries/TotallyEmptyLabel.vue deleted file mode 100644 index 4a50296f..00000000 --- a/tests/__tests__/components/queries/TotallyEmptyLabel.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/components/queries/index.js b/tests/__tests__/components/queries/index.js deleted file mode 100644 index 81c1cf97..00000000 --- a/tests/__tests__/components/queries/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import AltText from './AltText' -import Attribute from './Attribute' -import Empty from './Empty' -import LabelText from './LabelText' -import Placeholder from './Placeholder' -import TotallyEmptyLabel from './TotallyEmptyLabel' -import LabelWithNoFormControl from './LabelWithNoFormControl' -import GetByAltText from './GetByAltText' -import JestHelpers from './JestHelpers' - -export { - AltText, - Attribute, - Empty, - GetByAltText, - LabelText, - JestHelpers, - Placeholder, - TotallyEmptyLabel, - LabelWithNoFormControl -} diff --git a/tests/__tests__/router/programmatic-routing/components/About.vue b/tests/__tests__/router/programmatic-routing/components/About.vue deleted file mode 100644 index f66ade72..00000000 --- a/tests/__tests__/router/programmatic-routing/components/About.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/router/programmatic-routing/components/App.vue b/tests/__tests__/router/programmatic-routing/components/App.vue deleted file mode 100644 index c8451c7a..00000000 --- a/tests/__tests__/router/programmatic-routing/components/App.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/tests/__tests__/router/programmatic-routing/components/Home.vue b/tests/__tests__/router/programmatic-routing/components/Home.vue deleted file mode 100644 index a53fbda1..00000000 --- a/tests/__tests__/router/programmatic-routing/components/Home.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/tests/__tests__/router/programmatic-routing/components/LocationDisplay.vue b/tests/__tests__/router/programmatic-routing/components/LocationDisplay.vue deleted file mode 100644 index eecf2959..00000000 --- a/tests/__tests__/router/programmatic-routing/components/LocationDisplay.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/router/programmatic-routing/components/NoMatch.vue b/tests/__tests__/router/programmatic-routing/components/NoMatch.vue deleted file mode 100644 index 8118731c..00000000 --- a/tests/__tests__/router/programmatic-routing/components/NoMatch.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tests/__tests__/router/programmatic-routing/index.js b/tests/__tests__/router/programmatic-routing/index.js deleted file mode 100644 index 7396f3ff..00000000 --- a/tests/__tests__/router/programmatic-routing/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import 'jest-dom/extend-expect' - -import App from './components/App.vue' -import Home from './components/Home.vue' -import About from './components/About.vue' - -import { render, fireEvent } from '@testing-library/vue' - -const routes = [ - { path: '/', component: Home }, - { path: '/about', component: About }, - { path: '*', redirect: '/about' } -] - -test('navigating programmatically', async () => { - const { queryByTestId } = render(App, { routes }) - - expect(queryByTestId('location-display')).toHaveTextContent('/') - await fireEvent.click(queryByTestId('go-to-about')) - - expect(queryByTestId('location-display')).toHaveTextContent('/about') -}) From 290e2025793f6ab298969ea60c3645b6233d1d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Mon, 10 Jun 2019 20:00:49 +0200 Subject: [PATCH 3/9] Remove unused properties --- tests/__tests__/components/Button.vue | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/__tests__/components/Button.vue b/tests/__tests__/components/Button.vue index 7b9ea7ee..cfbf37f1 100644 --- a/tests/__tests__/components/Button.vue +++ b/tests/__tests__/components/Button.vue @@ -1,5 +1,5 @@