Skip to content

Commit

Permalink
Add types to test/index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
kienstra committed Oct 21, 2022
1 parent 53c8beb commit 06f7c4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/components/src/color-palette/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import userEvent from '@testing-library/user-event';
* Internal dependencies
*/
import ColorPalette from '..';
import type { ColorObject, OnColorChange } from '../types';

describe( 'ColorPalette', () => {
const colors = [
const colors: ColorObject[] = [
{ name: 'red', color: '#f00' },
{ name: 'white', color: '#fff' },
{ name: 'blue', color: '#00f' },
];
const currentColor = '#f00';
const onChange = jest.fn();
const onChange: jest.Mock< OnColorChange > = jest.fn();

beforeEach( () => {
onChange.mockClear();
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-palette/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import type { CSSProperties, MouseEventHandler, ReactNode } from 'react';

type OnColorChange = ( newColor?: string ) => void;
export type OnColorChange = ( newColor?: string ) => void;

export type ColorObject = {
name: string;
Expand Down

0 comments on commit 06f7c4e

Please sign in to comment.