|
8 | 8 | ResourceContextProvider, |
9 | 9 | ResourceProps, |
10 | 10 | ListBase, |
| 11 | + ResourceDefinitionContextProvider, |
11 | 12 | } from 'ra-core'; |
12 | 13 | import defaultMessages from 'ra-language-english'; |
13 | 14 | import polyglotI18nProvider from 'ra-i18n-polyglot'; |
@@ -140,16 +141,28 @@ export const LinkType = ({ |
140 | 141 | locationCallback?: (l: Location) => void; |
141 | 142 | }) => ( |
142 | 143 | <TestMemoryRouter locationCallback={locationCallback}> |
143 | | - <AdminContext dataProvider={myDataProvider}> |
144 | | - <ListBase resource="books" perPage={15}> |
145 | | - <Alert color="info">Inferred should target edit</Alert> |
146 | | - <SimpleList |
147 | | - primaryText={record => record.title} |
148 | | - secondaryText={record => record.author} |
149 | | - tertiaryText={record => record.year} |
150 | | - linkType={linkType} |
151 | | - /> |
152 | | - </ListBase> |
| 144 | + <AdminContext> |
| 145 | + <ResourceDefinitionContextProvider |
| 146 | + definitions={{ |
| 147 | + books: { |
| 148 | + name: 'books', |
| 149 | + hasList: true, |
| 150 | + hasEdit: true, |
| 151 | + hasShow: false, |
| 152 | + }, |
| 153 | + }} |
| 154 | + > |
| 155 | + <ResourceContextProvider value="books"> |
| 156 | + <Alert color="info">Inferred should target edit</Alert> |
| 157 | + <SimpleList |
| 158 | + data={data.books} |
| 159 | + primaryText={record => record.title} |
| 160 | + secondaryText={record => record.author} |
| 161 | + tertiaryText={record => record.year} |
| 162 | + linkType={linkType} |
| 163 | + /> |
| 164 | + </ResourceContextProvider> |
| 165 | + </ResourceDefinitionContextProvider> |
153 | 166 | </AdminContext> |
154 | 167 | </TestMemoryRouter> |
155 | 168 | ); |
@@ -180,16 +193,28 @@ export const RowClick = ({ |
180 | 193 | rowClick: string | RowClickFunction | false; |
181 | 194 | }) => ( |
182 | 195 | <TestMemoryRouter locationCallback={locationCallback}> |
183 | | - <AdminContext dataProvider={myDataProvider}> |
184 | | - <ListBase resource="books" perPage={15}> |
185 | | - <Alert color="info">Inferred should target edit</Alert> |
186 | | - <SimpleList |
187 | | - primaryText={record => record.title} |
188 | | - secondaryText={record => record.author} |
189 | | - tertiaryText={record => record.year} |
190 | | - rowClick={rowClick} |
191 | | - /> |
192 | | - </ListBase> |
| 196 | + <AdminContext> |
| 197 | + <ResourceDefinitionContextProvider |
| 198 | + definitions={{ |
| 199 | + books: { |
| 200 | + name: 'books', |
| 201 | + hasList: true, |
| 202 | + hasEdit: true, |
| 203 | + hasShow: false, |
| 204 | + }, |
| 205 | + }} |
| 206 | + > |
| 207 | + <ResourceContextProvider value="books"> |
| 208 | + <Alert color="info">Inferred should target edit</Alert> |
| 209 | + <SimpleList |
| 210 | + data={data.books} |
| 211 | + primaryText={record => record.title} |
| 212 | + secondaryText={record => record.author} |
| 213 | + tertiaryText={record => record.year} |
| 214 | + rowClick={rowClick} |
| 215 | + /> |
| 216 | + </ResourceContextProvider> |
| 217 | + </ResourceDefinitionContextProvider> |
193 | 218 | </AdminContext> |
194 | 219 | </TestMemoryRouter> |
195 | 220 | ); |
|
0 commit comments