@@ -85,6 +85,7 @@ describe('OverflowText', () => {
8585 setWidths ( label , 80 , 180 )
8686
8787 expect ( label . classList . contains ( 'overflow-hidden' ) ) . toBe ( true )
88+ expect ( label . classList . contains ( 'block' ) ) . toBe ( true )
8889 expect ( label . classList . contains ( 'text-clip' ) ) . toBe ( true )
8990 expect ( label . classList . contains ( 'whitespace-nowrap' ) ) . toBe ( true )
9091 expect ( label . classList . contains ( 'truncate' ) ) . toBe ( false )
@@ -211,6 +212,30 @@ describe('OverflowText', () => {
211212 expect ( label . className ) . not . toContain ( 'mask-image:linear-gradient' )
212213 } )
213214
215+ it ( 'remeasures when decorated content changes without changing the label' , ( ) => {
216+ act ( ( ) =>
217+ root . render (
218+ < OverflowText label = 'Workflow production' >
219+ Workflow < mark > production</ mark >
220+ </ OverflowText >
221+ )
222+ )
223+ const label = host . querySelector < HTMLElement > ( 'span' )
224+ if ( ! label ) throw new Error ( 'Overflow label did not render' )
225+
226+ setWidths ( label , 100 , 60 )
227+ Object . defineProperty ( label , 'scrollWidth' , { configurable : true , value : 180 } )
228+ act ( ( ) =>
229+ root . render (
230+ < OverflowText label = 'Workflow production' >
231+ Workflow < strong > production</ strong >
232+ </ OverflowText >
233+ )
234+ )
235+
236+ expect ( label . className ) . toContain ( 'mask-image:linear-gradient' )
237+ } )
238+
214239 it ( 'remeasures when loaded fonts change text width' , ( ) => {
215240 act ( ( ) => root . render ( < OverflowText label = 'Workflow name' /> ) )
216241 const label = host . querySelector < HTMLElement > ( 'span' )
0 commit comments