Skip to content

Commit 805356c

Browse files
committedSep 10, 2024·
Fix types and defaults
- set Props "run" to be optional. - fix test-utils
1 parent d7febf7 commit 805356c

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed
 

‎src/components/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Joyride extends React.Component<Props, State> {
3535
constructor(props: Props) {
3636
super(props);
3737

38-
const { debug, getHelpers, run, stepIndex } = props;
38+
const { debug, getHelpers, run = true, stepIndex } = props;
3939

4040
this.store = createStore({
4141
...props,

‎src/defaults.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { noop } from '~/modules/helpers';
22

3-
import { Locale } from '~/types';
3+
import { FloaterProps, Locale, Props, Step } from '~/types';
44

5-
export const defaultFloaterProps = {
5+
export const defaultFloaterProps: FloaterProps = {
66
options: {
77
preventOverflow: {
88
boundariesElement: 'scrollParent',
@@ -43,7 +43,7 @@ export const defaultStep = {
4343
showSkipButton: false,
4444
spotlightClicks: false,
4545
spotlightPadding: 10,
46-
};
46+
} satisfies Omit<Step, 'content' | 'target'>;
4747

4848
export const defaultProps = {
4949
continuous: false,
@@ -64,4 +64,4 @@ export const defaultProps = {
6464
spotlightClicks: false,
6565
spotlightPadding: 10,
6666
steps: [],
67-
};
67+
} satisfies Props;

‎src/types/components.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export type Props = Simplify<
178178
* Run/stop the tour.
179179
* @default true
180180
*/
181-
run: boolean;
181+
run?: boolean;
182182
/**
183183
* The duration for scroll to element.
184184
* @default 300
@@ -378,3 +378,5 @@ export type TooltipRenderProps = Simplify<
378378
};
379379
}
380380
>;
381+
382+
export type { Props as FloaterProps } from 'react-floater';

‎test/__fixtures__/test-utils.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
queryHelpers,
77
render,
88
RenderOptions,
9-
screen,
109
within,
1110
} from '@testing-library/react';
1211

@@ -41,7 +40,7 @@ const allQueries = {
4140
...customQueries,
4241
};
4342

44-
const customScreen = { ...screen, ...within(document.body, allQueries) };
43+
const customScreen = within(document.body, allQueries);
4544
const customWithin = (element: HTMLElement) => within(element, allQueries);
4645
const customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>) =>
4746
render(ui, { queries: allQueries, ...options });

0 commit comments

Comments
 (0)
Please sign in to comment.