Skip to content

Exporting some utility helpers #6837

Open

Description

Is your feature request related to a problem? Please describe.

While on terms of usability and accessibility the framework is improving, it is becoming challenging to test on these aspects as they are now computing at runtime.
For instance button colours are now computed at runtime with chroma and emotion to improve the contrast ratio: https://github.com/elastic/eui/blob/main/src/themes/amsterdam/global_styling/mixins/button.ts#L76

For instance in this Kibana test I had to give up with a static value check, like a snapshot test, as computing the actual value would just duplicate a logic here in EUI, which would be even worst: https://github.com/elastic/kibana/blob/66ae25d376ecc1ea8ca82d60e7fb4edfa09192d3/x-pack/plugins/lens/public/shared_components/dataview_picker/trigger.test.tsx#LL61C67-L61C83

But some can be applied to other components like the select component with multiple selections. Etc..

Describe the solution you'd like
It would be nice to have some helpers to simplify the testing on the consumer side.
For colors that could be publishing all computed variants in a euiThemeDebugVars json, or just provide a function helper.
For other component some other solution might help.

I think that some dog fooding here would help, as you are probably the best to find the right helper API to test the component on your side. Just exporting them would already make things much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    feature requesttaskA task associated with a larger Meta issuetestingIssues or PRs that only affect tests - will not need changelog entries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions