Skip to content

Commit

Permalink
Fix Emotion snapshots not being correctly converted to static classNa…
Browse files Browse the repository at this point in the history
…mes (elastic#6051)

- due to emotion sometimes outputting 5-char hashes instead of 6
  • Loading branch information
Constance authored Jul 14, 2022
1 parent 48e4b75 commit 141b340
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/health/__snapshots__/health.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ exports[`EuiHealth props textSize inherit is rendered 1`] = `

exports[`EuiHealth props textSize m is rendered 1`] = `
<div
class="euiHealth css-28ntf-euiHealth-m"
class="euiHealth emotion-euiHealth-m"
>
<div
class="euiFlexGroup euiFlexGroup--gutterExtraSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports[`EuiLoadingChart size xl is rendered 1`] = `
class="emotion-euiLoadingChart__bar-xl"
/>
<span
class="css-3rl1i-euiLoadingChart__bar-xl"
class="emotion-euiLoadingChart__bar-xl"
/>
<span
class="emotion-euiLoadingChart__bar-xl"
Expand Down
2 changes: 1 addition & 1 deletion src/components/stat/__snapshots__/stat.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports[`EuiStat props accent is rendered 1`] = `
</div>
<p
aria-hidden="true"
class="euiTitle euiStat__title css-v0lnn-euiTitle-l-euiStat__title-accent"
class="euiTitle euiStat__title emotion-euiTitle-l-euiStat__title-accent"
>
title
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/test/emotion-prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const replaceEmotionPrefix = (selector: string) => {
// Contains `eui[ComponentName] or `Eui[ComponentName]`.
// Capture the component name (from above) and all variant additions until the end of the string.
const euiMatch = selector.match(
/css-[\d\w]{6,}-(?<euiComponent>[eE]ui[A-Z][\d\w-]*$)/
/css-[\d\w]{5,}-(?<euiComponent>[eE]ui[A-Z][\d\w-]*$)/
);
// Use the captured group (`euiComponent`) if available and prepend with `emotion-`,
// otherwise use the full selector.
Expand Down

0 comments on commit 141b340

Please sign in to comment.