-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Emotion][perf] Memoize
EuiButton
styles & mixins (#7541)
- Loading branch information
Showing
9 changed files
with
320 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 changes: 181 additions & 0 deletions
181
src/themes/amsterdam/global_styling/mixins/__snapshots__/button.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`useEuiButtonColorCSS base 1`] = ` | ||
Object { | ||
"accent": Object { | ||
"map": undefined, | ||
"name": "1uoldaz-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#a03465;background-color:#fcdcea;;;label:base-accent;", | ||
"toString": [Function], | ||
}, | ||
"danger": Object { | ||
"map": undefined, | ||
"name": "1cquuvx-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#ab231c;background-color:#f2d4d2;;;label:base-danger;", | ||
"toString": [Function], | ||
}, | ||
"disabled": Object { | ||
"map": undefined, | ||
"name": "13xo60b-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#a2abba;background-color:rgba(211,218,230,0.15);;;label:base-disabled;", | ||
"toString": [Function], | ||
}, | ||
"primary": Object { | ||
"map": undefined, | ||
"name": "1thox14-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#0061a6;background-color:#cce4f5;;;label:base-primary;", | ||
"toString": [Function], | ||
}, | ||
"success": Object { | ||
"map": undefined, | ||
"name": "1j0clgi-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#006c66;background-color:#ccf2f0;;;label:base-success;", | ||
"toString": [Function], | ||
}, | ||
"text": Object { | ||
"map": undefined, | ||
"name": "40srs0-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#343741;background-color:#e9edf3;;;label:base-text;", | ||
"toString": [Function], | ||
}, | ||
"warning": Object { | ||
"map": undefined, | ||
"name": "19dh407-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#83650a;background-color:#fff3d0;;;label:base-warning;", | ||
"toString": [Function], | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useEuiButtonColorCSS empty 1`] = ` | ||
Object { | ||
"accent": Object { | ||
"map": undefined, | ||
"name": "cy4kjs-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#a03465;&:focus,&:active{background-color:rgba(240,78,152,0.1);};label:empty-accent;", | ||
"toString": [Function], | ||
}, | ||
"danger": Object { | ||
"map": undefined, | ||
"name": "j8xrk3-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#ab231c;&:focus,&:active{background-color:rgba(189,39,30,0.1);};label:empty-danger;", | ||
"toString": [Function], | ||
}, | ||
"disabled": Object { | ||
"map": undefined, | ||
"name": "2vymtv-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#a2abba;&:focus,&:active{background-color:transparent;};label:empty-disabled;", | ||
"toString": [Function], | ||
}, | ||
"primary": Object { | ||
"map": undefined, | ||
"name": "15isz8i-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#0061a6;&:focus,&:active{background-color:rgba(0,119,204,0.1);};label:empty-primary;", | ||
"toString": [Function], | ||
}, | ||
"success": Object { | ||
"map": undefined, | ||
"name": "h2w3e9-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#006c66;&:focus,&:active{background-color:rgba(0,191,179,0.1);};label:empty-success;", | ||
"toString": [Function], | ||
}, | ||
"text": Object { | ||
"map": undefined, | ||
"name": "1dqg6bz-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#343741;&:focus,&:active{background-color:rgba(211,218,230,0.2);};label:empty-text;", | ||
"toString": [Function], | ||
}, | ||
"warning": Object { | ||
"map": undefined, | ||
"name": "w61e3r-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#83650a;&:focus,&:active{background-color:rgba(254,197,20,0.1);};label:empty-warning;", | ||
"toString": [Function], | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useEuiButtonColorCSS fill 1`] = ` | ||
Object { | ||
"accent": Object { | ||
"map": undefined, | ||
"name": "vi45v3-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#000;background-color:#f583b7;outline-color:#000;;label:fill-accent;", | ||
"toString": [Function], | ||
}, | ||
"danger": Object { | ||
"map": undefined, | ||
"name": "1ge48z4-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#FFF;background-color:#BD271E;outline-color:#000;;label:fill-danger;", | ||
"toString": [Function], | ||
}, | ||
"disabled": Object { | ||
"map": undefined, | ||
"name": "xc42v8-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#a2abba;background-color:rgba(211,218,230,0.15);outline-color:#000;;label:fill-disabled;", | ||
"toString": [Function], | ||
}, | ||
"primary": Object { | ||
"map": undefined, | ||
"name": "btstjy-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#FFF;background-color:#07C;outline-color:#000;;label:fill-primary;", | ||
"toString": [Function], | ||
}, | ||
"success": Object { | ||
"map": undefined, | ||
"name": "p9aexd-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#000;background-color:#4dd2ca;outline-color:#000;;label:fill-success;", | ||
"toString": [Function], | ||
}, | ||
"text": Object { | ||
"map": undefined, | ||
"name": "5c80s5-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#FFF;background-color:#69707D;outline-color:#000;;label:fill-text;", | ||
"toString": [Function], | ||
}, | ||
"warning": Object { | ||
"map": undefined, | ||
"name": "17xxsr5-displaysColorsMap-display-color", | ||
"next": undefined, | ||
"styles": "color:#000;background-color:#FEC514;outline-color:#000;;label:fill-warning;", | ||
"toString": [Function], | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useEuiButtonFocusCSS 1`] = ` | ||
Object { | ||
"map": undefined, | ||
"name": "1s8jae7-focusCSS", | ||
"next": Object { | ||
"name": "animation-70pju1", | ||
"next": undefined, | ||
"styles": "@keyframes animation-70pju1{ | ||
50% { | ||
transform: translateY(1px); | ||
} | ||
}", | ||
}, | ||
"styles": "@media screen and (prefers-reduced-motion: no-preference){transition:transform 250ms ease-in-out,background-color 250ms ease-in-out;&:hover:not(:disabled){transform:translateY(-1px);}&:focus{animation:animation-70pju1 250ms cubic-bezier(.34, 1.61, .7, 1);}&:active:not(:disabled){transform:translateY(1px);}};", | ||
"toString": [Function], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { renderHook } from '@testing-library/react'; | ||
|
||
import { | ||
useEuiButtonColorCSS, | ||
BUTTON_DISPLAYS, | ||
useEuiButtonFocusCSS, | ||
} from './button'; | ||
|
||
describe('useEuiButtonColorCSS', () => { | ||
BUTTON_DISPLAYS.forEach((display) => { | ||
test(display, () => { | ||
const { result } = renderHook(() => useEuiButtonColorCSS({ display })); | ||
expect(result.current).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
|
||
test('useEuiButtonFocusCSS', () => { | ||
const { result } = renderHook(() => useEuiButtonFocusCSS()); | ||
expect(result.current).toMatchSnapshot(); | ||
}); |
Oops, something went wrong.