Skip to content

Commit

Permalink
Fix failing dark mode style test
Browse files Browse the repository at this point in the history
- not totally sure why this requires an async/await now - maybe because the color is still transitioning between the two? :|
  • Loading branch information
cee-chen committed Sep 16, 2024
1 parent b56159b commit 9fe4c31
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/eui/src/components/form/form.styles.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {

const darkModeWrapper: FunctionComponent<PropsWithChildren> = ({
children,
}) => <EuiProvider colorMode="DARK">{children}</EuiProvider>;
}) => <EuiProvider colorMode="dark">{children}</EuiProvider>;

describe('euiFormVariables', () => {
it('outputs an object of reusable form vars', () => {
Expand Down Expand Up @@ -59,13 +59,16 @@ describe('euiFormVariables', () => {
`);
});

test('dark mode', () => {
const { result } = renderHook(() => euiFormVariables(useEuiTheme()), {
wrapper: darkModeWrapper,
test('dark mode', async () => {
await (() => {
const { result } = renderHook(() => euiFormVariables(useEuiTheme()), {
wrapper: darkModeWrapper,
});

// Check custom dark-mode logic
expect(result.current.backgroundColor).toEqual('#16171c');
expect(result.current.controlPlaceholderText).toEqual('#878b95');
});
// Check custom dark-mode logic
expect(result.current.backgroundColor).toEqual('#16171c');
expect(result.current.controlPlaceholderText).toEqual('#878b95');
});
});

Expand Down

0 comments on commit 9fe4c31

Please sign in to comment.