@@ -14,6 +14,7 @@ export default {
1414 onSearch : fn ( ) ,
1515 onSelectMessage : fn ( ) ,
1616 onDeselectMessage : fn ( ) ,
17+ filterLimit : 50 ,
1718 } ,
1819 render : ( props ) => < MessagesTable { ...props } messages = { sampleData ( props ) } /> ,
1920} as Meta < typeof MessagesTable > ;
@@ -25,13 +26,17 @@ export const Example: Story = {
2526 const canvas = within ( canvasElement ) ;
2627 const messages = sampleData ( args ) ;
2728
29+ expect ( messages . length ) . toBeGreaterThan ( 0 ) ;
2830 const rows = await canvas . findAllByRole ( "row" ) ;
2931
3032 const targetRow = rows . find ( ( r ) =>
3133 r . textContent ?. includes ( "this-is-a-very-long-key" ) ,
3234 ) ;
33- expect ( targetRow ) . toBeDefined ( ) ;
34- await userEvent . click ( targetRow ! ) ;
35+
36+ if ( ! targetRow ) {
37+ throw new Error ( `Target row not found. Available rows: ${ rows . length } ` ) ;
38+ }
39+ await userEvent . click ( targetRow ) ;
3540 await expect ( args . onSelectMessage ) . toHaveBeenCalledWith ( messages [ 1 ] ) ;
3641
3742 const search = await canvas . findByDisplayValue ( / m e s s a g e s = l a t e s t / i) ;
@@ -55,13 +60,16 @@ export const Example: Story = {
5560export const SearchWithMatches : Story = {
5661 args : {
5762 filterQuery : "foo" ,
63+ filterWhere : "value" ,
5864 } ,
5965 play : async ( { canvasElement } ) => {
6066 const canvas = within ( canvasElement ) ;
61- const marks = canvasElement . querySelectorAll ( "mark" ) ;
62- expect ( marks . length ) . toBeGreaterThan ( 0 ) ;
67+
68+ const highlighted = await canvas . findAllByText ( / f o o / i) ;
69+ expect ( highlighted . length ) . toBeGreaterThan ( 0 ) ;
6370 } ,
6471} ;
72+
6573export const SearchWithoutMatches : Story = {
6674 args : {
6775 filterQuery : "lorem dolor" ,
0 commit comments