Skip to content

Commit

Permalink
Refactor Tooltip into a function component (#355)
Browse files Browse the repository at this point in the history
## This change includes:

- Refactoring Tooltip to be a function component, using hooks for state and effects
- Remove the intermediary EscapableTooltip (Fixes #354)
- Update all the unit tests to avoid using `setState()` and `state()` in favour of simulating clicks and asserting the DOM directly. This is compatible with hooks, and is a better design of black-box testing
- Split out server tests and run them in Jest's server environment
- Upgrade Enzyme (only a minor version bump) to support new Hooks testing features (see enzymejs/enzyme#2073)
  • Loading branch information
wac925 committed Jul 1, 2019
1 parent 446ea11 commit bd743e2
Show file tree
Hide file tree
Showing 8 changed files with 1,076 additions and 1,170 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
// Since this code must run in IE11, it has stricter constraints than other parts of
// this repo.
files: ['packages/thumbprint-react/**/*'],
excludedFiles: ['test.jsx', '*.config.js'],
excludedFiles: ['*test.jsx', '*.config.js'],
rules: {
// Check for uses of browser/DOM APIs that are not available in our supported browsers.
'compat/compat': 'error',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"babel-jest": "^24.0.0",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-external-helpers": "^6.22.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.12.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.3.4",
"eslint": "^5.9.0",
"eslint-config-airbnb": "^17.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/thumbprint-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Patch] Refactor ModalCurtain to be a function component and use hooks.
- [Patch] Refactor Tooltip to use the new hooks.
- [Patch] Refactor Popover to use the new hooks.
- [Patch] Refactor Tooltip to be a functional component and update its tests.

### Fixed

Expand Down
Loading

0 comments on commit bd743e2

Please sign in to comment.