Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiTextTruncate] Fix testenv mocks #7234

Merged
merged 4 commits into from
Sep 29, 2023
Merged

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Sep 29, 2023

Summary

😬 I messed up the TruncationUtils testenv mocks I set up in #7215 and they're currently causing Kibana CI to throw a bunch of Jest super errors.

This PR should resolve the issues by narrowing down our mocks to only the canvas APIs that don't exist in Jest/JSDOM, as opposed to attempting to mock TruncationUtils as well

QA

EUI testing

  • yarn test-unit text_truncate passes
  • yarn test-unit services/canvas passes
  • yarn test-unit combo_box passes

Kibana testing

  • yarn build-pack
  • Point local Kibana at the output tgz
  • yarn kbn bootstrap --no-validate
  • yarn test:jest x-pack/plugins/monitoring/public/components/renderers and ensure all tests pass

General checklist

  • Browser QA - N/A, tests only
  • Docs site QA - N/A, tests only
  • Code quality checklist - see above
  • Release checklist
    • A changelog entry exists and is marked appropriately.
      - [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist - N/A, tests only

- separating it from EuiTextTruncate utils makes it easier to mock without shenanigans

- since it's being used outside of truncation contexts, might as well make it a generic service
- to only mock the canvas util (which is the one with Jest dependency issues, not the text truncation util itself)
- move canvas tests out of text_truncate

- update existing method of mocking canvas width, since the new `testenv` file now allows bypassing setting `HTMLCanvasElement`
@cee-chen cee-chen marked this pull request as ready for review September 29, 2023 02:32
@cee-chen cee-chen requested a review from a team as a code owner September 29, 2023 02:32
@cee-chen
Copy link
Contributor Author

Would appreciate a review from either @breehall or @1Copenut tomorrow morning, whichever of you has more time first 🙇 This is unfortunately blocking the next Kibana upgrade - I'll need to do another patch release once this merges in.

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

Copy link
Contributor

@breehall breehall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes the service easy to reuse if we need to in the future. I pulled this branch locally to validate tests after reviewing code - no failing tests. Let's unblock Kibana!

@cee-chen
Copy link
Contributor Author

Thanks a million Bree!

@cee-chen cee-chen merged commit 1fa8cf0 into elastic:main Sep 29, 2023
2 checks passed
@cee-chen cee-chen deleted the fix-canvas-testenv branch September 29, 2023 15:33
cee-chen added a commit to elastic/kibana that referenced this pull request Oct 4, 2023
`v88.5.0`⏩`v88.5.4`

This EUI upgrade helps unblock the Shared UX team with some beta
serverless nav updates not listed in the below changelog
(elastic/eui#7228 and
elastic/eui#7248).

---

## [`88.5.4`](https://github.com/elastic/eui/tree/v88.5.4)

- This release contains internal changes to a beta component needed by
Kibana.

## [`88.5.3`](https://github.com/elastic/eui/tree/v88.5.3)

**Bug fixes**

- Fixed `EuiComboBox` search input width not resetting correctly on
selection ([#7240](elastic/eui#7240))

## [`88.5.2`](https://github.com/elastic/eui/tree/v88.5.2)

**Bug fixes**

- Fixed broken `EuiTextTruncate` testenv mocks
([#7234](elastic/eui#7234))

## [`88.5.1`](https://github.com/elastic/eui/tree/v88.5.1)

- Improved the performance of `EuiComboBox` by removing the
`react-autosizer-input` dependency
([#7215](elastic/eui#7215))

**Dependency updates**

- Updated `react-element-to-jsx-string` to v5.0.0
([#7214](elastic/eui#7214))
- Removed unused `@types/vfile-message` dependency
([#7214](elastic/eui#7214))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants