@@ -118,6 +118,13 @@ const TABLE = `
118118
119119 ` ;
120120
121+ const TABLE_WITH_INLINE_CODE = `
122+ | Status | Finding |
123+ |---|---|
124+ | \`1/1 Running\`, 0 restarts | Healthy — no crashes |
125+ | \`1/1 Ready\` | Desired replicas met |
126+ ` ;
127+
121128const ONE_COLUMN_TABLE = `
122129
123130 | Column 1 |
@@ -1041,6 +1048,24 @@ describe('Message', () => {
10411048 render ( < Message avatar = "./img" role = "user" name = "User" content = { TABLE } tableProps = { { 'aria-label' : 'Test' } } /> ) ;
10421049 expect ( screen . getByRole ( 'grid' , { name : / T e s t / i } ) ) . toBeTruthy ( ) ;
10431050 } ) ;
1051+ it ( 'should wrap table cell content so inline code does not break grid layout' , ( ) => {
1052+ render (
1053+ < Message
1054+ avatar = "./img"
1055+ role = "user"
1056+ name = "User"
1057+ content = { TABLE_WITH_INLINE_CODE }
1058+ tableProps = { { 'aria-label' : 'Inline code table' } }
1059+ />
1060+ ) ;
1061+ const statusCell = screen . getByRole ( 'cell' , { name : / 1 \/ 1 R u n n i n g / i } ) ;
1062+ expect ( statusCell . querySelector ( ':scope > .pf-chatbot__message-table-cell-content' ) ) . toBeTruthy ( ) ;
1063+ expect ( statusCell . querySelector ( ':scope > code' ) ) . toBeFalsy ( ) ;
1064+ expect ( statusCell . querySelector ( '.pf-chatbot__message-inline-code' ) ) . toBeTruthy ( ) ;
1065+ expect (
1066+ screen . getByRole ( 'columnheader' , { name : / S t a t u s / i } ) . querySelector ( '.pf-chatbot__message-table-cell-content' )
1067+ ) . toBeTruthy ( ) ;
1068+ } ) ;
10441069 it ( 'should render footnote correctly' , ( ) => {
10451070 render ( < Message avatar = "./img" role = "user" name = "User" content = { FOOTNOTE } /> ) ;
10461071 expect ( screen . getByText ( / T h i s i s s o m e t e x t w i t h a f o o t n o t e / i) ) . toBeTruthy ( ) ;
0 commit comments