@@ -66,6 +66,30 @@ Providers.propTypes = {
66
66
children : PropTypes . element . isRequired
67
67
} ;
68
68
69
+ /**
70
+ * @typedef {import('@testing-library/react').RenderOptions } RenderOptions
71
+ * @typedef {import('@testing-library/react').RenderResult } RenderResult
72
+ */
73
+
74
+ /**
75
+ * @typedef {object } CustomRenderOptions
76
+ * @extends RenderOptions
77
+ * @property {boolean } [mobile] - Can use options { mobile: true } or { mobile: false } to determine which `react-responsive` media queries will match.
78
+ * @property {number } [deviceWidth] - Can set a specific device width, if testing more than 2 breakpoints. ie. { deviceWidth: 700 }
79
+ */
80
+
81
+ /**
82
+ * @typedef {object } ReduxRenderOptions
83
+ * @extends CustomRenderOptions
84
+ * @property [initialState] - Can pass in a partial initialState for the Redux store, to be shallow merged with the default state. // TODO: deep merge
85
+ * @property {import('redux').Store } [store] - Can use a custom store instance.
86
+ */
87
+
88
+ /**
89
+ * @param {React.ReactElement } ui
90
+ * @param {ReduxRenderOptions & CustomRenderOptions & RenderOptions } [options]
91
+ * @return {RenderResult & { store: import('redux').Store } }
92
+ */
69
93
function reduxRender (
70
94
ui ,
71
95
{ initialState, store = configureStore ( initialState ) , ...renderOptions } = { }
@@ -91,6 +115,11 @@ function reduxRender(
91
115
return { store, ...render ( ui , { wrapper : Wrapper , ...renderOptions } ) } ;
92
116
}
93
117
118
+ /**
119
+ * @param {React.ReactElement } ui
120
+ * @param {CustomRenderOptions & RenderOptions } [options]
121
+ * @return {RenderResult }
122
+ */
94
123
const customRender = ( ui , options ) =>
95
124
// Pass options to Provider, see: https://github.com/testing-library/react-testing-library/issues/780#issuecomment-687525893
96
125
render ( ui , {
0 commit comments