Skip to content

Commit

Permalink
Merge pull request #193 from Typeform/chore/testing-library
Browse files Browse the repository at this point in the history
chore: Testing library dom
  • Loading branch information
scarciofolomarco authored Mar 2, 2021
2 parents 5966ab6 + 539236c commit a7dc4f8
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 13 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"@semantic-release/github": "^7.2.0",
"@semantic-release/npm": "^7.0.10",
"@semantic-release/release-notes-generator": "^9.0.1",
"@testing-library/dom": "^7.29.4",
"@testing-library/dom": "^7.29.6",
"@testing-library/jest-dom": "^5.11.9",
"@typeform/eslint-config": "^3.0.2",
"@types/cypress": "^1.1.3",
"@types/jest": "^26.0.20",
Expand Down
1 change: 1 addition & 0 deletions packages/embed/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom'
3 changes: 2 additions & 1 deletion packages/embed/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"^.+\\.(ts|tsx)$": "ts-jest"
},
"testMatch": ["**/src/**/*.spec.(ts|tsx)"],
"coverageReporters": [["lcov", { "projectRoot": "../.." }]]
"coverageReporters": [["lcov", { "projectRoot": "../.." }]],
"setupFilesAfterEnv": ["<rootDir>/jest-setup.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ describe('create-popup', () => {
it('should render the popup', () => {
const popupElement = container.querySelector('.typeform-popup') as HTMLElement
const wrapper = popupElement.querySelector('.typeform-iframe-wrapper') as HTMLElement
expect(popupElement).toBeTruthy()
expect(popupElement.querySelector('.typeform-spinner')).toBeTruthy()
expect(popupElement).toBeVisible()
expect(popupElement.querySelector('.typeform-spinner')).toBeVisible()
expect(wrapper.querySelector('iframe')).toBeTruthy()
expect(wrapper.querySelector('.typeform-close')).toBeTruthy()
expect(wrapper.style.width).toBe('200px')
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"typeRoots": ["./types", "./node_modules/@types"],
"types": ["@types/jest", "node"]
},
"include": ["src/**/*.ts*"]
"include": ["src/**/*.ts*", "./jest-setup.ts"]
}
61 changes: 53 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,13 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.9.2":
version "7.13.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.9.tgz#97dbe2116e2630c489f22e0656decd60aaa1fcee"
integrity sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/template@^7.10.4", "@babel/template@^7.12.7", "@babel/template@^7.3.3":
version "7.12.7"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc"
Expand Down Expand Up @@ -3317,10 +3324,10 @@
"@svgr/plugin-svgo" "^5.5.0"
loader-utils "^2.0.0"

"@testing-library/dom@^7.29.4":
version "7.29.4"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.29.4.tgz#1647c2b478789621ead7a50614ad81ab5ae5b86c"
integrity sha512-CtrJRiSYEfbtNGtEsd78mk1n1v2TUbeABlNIcOCJdDfkN5/JTOwQEbbQpoSRxGqzcWPgStMvJ4mNolSuBRv1NA==
"@testing-library/dom@^7.29.6":
version "7.29.6"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.29.6.tgz#eb37844fb431186db7960a7ff6749ea65a19617c"
integrity sha512-vzTsAXa439ptdvav/4lsKRcGpAQX7b6wBIqia7+iNzqGJ5zjswApxA6jDAsexrc6ue9krWcbh8o+LYkBXW+GCQ==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/runtime" "^7.12.5"
Expand All @@ -3331,13 +3338,27 @@
lz-string "^1.4.4"
pretty-format "^26.6.2"

"@testing-library/jest-dom@^5.11.9":
version "5.11.9"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.9.tgz#e6b3cd687021f89f261bd53cbe367041fbd3e975"
integrity sha512-Mn2gnA9d1wStlAIT2NU8J15LNob0YFBVjs2aEQ3j8rsfRQo+lAs7/ui1i2TGaJjapLmuNPLTsrm+nPjmZDwpcQ==
dependencies:
"@babel/runtime" "^7.9.2"
"@types/testing-library__jest-dom" "^5.9.1"
aria-query "^4.2.2"
chalk "^3.0.0"
css "^3.0.0"
css.escape "^1.5.1"
lodash "^4.17.15"
redent "^3.0.0"

"@tootallnate/once@1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@typeform/embed@file:packages/embed":
version "1.0.0-next.2"
version "1.0.0-next.11"

"@typeform/eslint-config@^3.0.2":
version "3.0.2"
Expand Down Expand Up @@ -3476,7 +3497,7 @@
dependencies:
"@types/istanbul-lib-report" "*"

"@types/[email protected]", "@types/jest@^26.0.20":
"@types/jest@*", "@types/jest@26.x", "@types/jest@^26.0.20":
version "26.0.20"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.20.tgz#cd2f2702ecf69e86b586e1f5223a60e454056307"
integrity sha512-9zi2Y+5USJRxd0FsahERhBwlcvFh6D2GLQnY2FH2BzK8J9s9omvNHIbvABwIluXa0fD8XVKMLTO0aOEuUfACAA==
Expand Down Expand Up @@ -3566,6 +3587,13 @@
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74"
integrity sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==

"@types/testing-library__jest-dom@^5.9.1":
version "5.9.5"
resolved "https://registry.yarnpkg.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.9.5.tgz#5bf25c91ad2d7b38f264b12275e5c92a66d849b0"
integrity sha512-ggn3ws+yRbOHog9GxnXiEZ/35Mow6YtPZpd7Z5mKDeZS/o7zx3yAle0ov/wjhVB5QT4N2Dt+GNoGCdqkBGCajQ==
dependencies:
"@types/jest" "*"

"@types/uglify-js@*":
version "3.12.0"
resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.12.0.tgz#2bb061c269441620d46b946350c8f16d52ef37c5"
Expand Down Expand Up @@ -5489,7 +5517,7 @@ [email protected], chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.1, chalk@^2.3.2, chalk@^2.4.
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

[email protected]:
[email protected], chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
Expand Down Expand Up @@ -6501,7 +6529,7 @@ css-what@^3.2.1:
resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4"
integrity sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==

[email protected]:
[email protected], css.escape@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb"
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
Expand All @@ -6516,6 +6544,15 @@ css@^2.0.0:
source-map-resolve "^0.5.2"
urix "^0.1.0"

css@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/css/-/css-3.0.0.tgz#4447a4d58fdd03367c516ca9f64ae365cee4aa5d"
integrity sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==
dependencies:
inherits "^2.0.4"
source-map "^0.6.1"
source-map-resolve "^0.6.0"

cssdb@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/cssdb/-/cssdb-4.4.0.tgz#3bf2f2a68c10f5c6a08abd92378331ee803cddb0"
Expand Down Expand Up @@ -16173,6 +16210,14 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2:
source-map-url "^0.4.0"
urix "^0.1.0"

source-map-resolve@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.6.0.tgz#3d9df87e236b53f16d01e58150fc7711138e5ed2"
integrity sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==
dependencies:
atob "^2.1.2"
decode-uri-component "^0.2.0"

source-map-support@^0.5.6, source-map-support@~0.5.12, source-map-support@~0.5.19:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
Expand Down

0 comments on commit a7dc4f8

Please sign in to comment.