@@ -305,6 +305,123 @@ describe("Timeline", () => {
305305 ) ;
306306 } ) ;
307307
308+ it ( "should render EventTiles on IRC, modern (group), and bubble layout" , ( ) => {
309+ // Exclude timestamp and read marker from snapshots
310+ const percyCSS = ".mx_MessageTimestamp, .mx_RoomView_myReadMarker { visibility: hidden !important; }" ;
311+
312+ sendEvent ( roomId ) ;
313+ sendEvent ( roomId ) ; // check continuation
314+ sendEvent ( roomId ) ; // check the last EventTile
315+
316+ cy . visit ( "/#/room/" + roomId ) ;
317+
318+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
319+ // IRC layout
320+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
321+
322+ cy . setSettingValue ( "layout" , null , SettingLevel . DEVICE , Layout . IRC ) ;
323+
324+ // Wait until configuration is finished
325+ cy . contains (
326+ ".mx_RoomView_body .mx_GenericEventListSummary[data-layout=irc] .mx_GenericEventListSummary_summary" ,
327+ "created and configured the room." ,
328+ ) . should ( "exist" ) ;
329+
330+ cy . get ( ".mx_RoomView_body[data-layout=irc]" ) . within ( ( ) => {
331+ // Ensure CSS declarations which cannot be detected with a screenshot test are applied as expected
332+ cy . get ( ".mx_EventTile" )
333+ . should ( "have.css" , "max-width" , "100%" )
334+ . should ( "have.css" , "clear" , "both" )
335+ . should ( "have.css" , "position" , "relative" ) ;
336+
337+ // Check mx_EventTile_continuation
338+ // Block start padding of the second message should not be overridden
339+ cy . get ( ".mx_EventTile_continuation" ) . should ( "have.css" , "padding-block-start" , "0px" ) ;
340+ cy . get ( ".mx_EventTile_continuation .mx_EventTile_line" ) . should ( "have.css" , "clear" , "both" ) ;
341+
342+ // Select the last event tile
343+ cy . get ( ".mx_EventTile_last" )
344+ . within ( ( ) => {
345+ // The last tile is also a continued one
346+ cy . get ( ".mx_EventTile_line" ) . should ( "have.css" , "clear" , "both" ) ;
347+ } )
348+ // Check that zero block padding is set
349+ . should ( "have.css" , "padding-block-start" , "0px" ) ;
350+ } ) ;
351+
352+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "EventTiles on IRC layout" , { percyCSS } ) ;
353+
354+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
355+ // Group/modern layout
356+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
357+
358+ cy . setSettingValue ( "layout" , null , SettingLevel . DEVICE , Layout . Group ) ;
359+
360+ cy . get ( ".mx_RoomView_body[data-layout=group]" ) . within ( ( ) => {
361+ // Ensure CSS declarations which cannot be detected with a screenshot test are applied as expected
362+ cy . get ( ".mx_EventTile" )
363+ . should ( "have.css" , "max-width" , "100%" )
364+ . should ( "have.css" , "clear" , "both" )
365+ . should ( "have.css" , "position" , "relative" ) ;
366+
367+ // Check mx_EventTile_continuation
368+ // Block start padding of the second message should not be overridden
369+ cy . get ( ".mx_EventTile_continuation" ) . should ( "have.css" , "padding-block-start" , "0px" ) ;
370+ cy . get ( ".mx_EventTile_continuation .mx_EventTile_line" ) . should ( "have.css" , "clear" , "both" ) ;
371+
372+ // Check that the last EventTile is rendered
373+ cy . get ( ".mx_EventTile.mx_EventTile_last" ) . should ( "exist" ) ;
374+ } ) ;
375+
376+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "EventTiles on modern layout" , { percyCSS } ) ;
377+
378+ // Check the same thing for compact layout
379+ cy . setSettingValue ( "useCompactLayout" , null , SettingLevel . DEVICE , true ) ;
380+
381+ cy . get ( ".mx_MatrixChat_useCompactLayout" ) . within ( ( ) => {
382+ // Ensure CSS declarations which cannot be detected with a screenshot test are applied as expected
383+ cy . get ( ".mx_EventTile" )
384+ . should ( "have.css" , "max-width" , "100%" )
385+ . should ( "have.css" , "clear" , "both" )
386+ . should ( "have.css" , "position" , "relative" ) ;
387+
388+ // Check cascading works
389+ cy . get ( ".mx_EventTile_continuation" ) . should ( "have.css" , "padding-block-start" , "0px" ) ;
390+
391+ // Check that the last EventTile is rendered
392+ cy . get ( ".mx_EventTile.mx_EventTile_last" ) . should ( "exist" ) ;
393+ } ) ;
394+
395+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "EventTiles on compact modern layout" , { percyCSS } ) ;
396+
397+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
398+ // Message bubble layout
399+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
400+
401+ cy . setSettingValue ( "layout" , null , SettingLevel . DEVICE , Layout . Bubble ) ;
402+
403+ cy . get ( ".mx_RoomView_body[data-layout=bubble]" ) . within ( ( ) => {
404+ // Ensure CSS declarations which cannot be detected with a screenshot test are applied as expected
405+ cy . get ( ".mx_EventTile" )
406+ . should ( "have.css" , "max-width" , "none" )
407+ . should ( "have.css" , "clear" , "both" )
408+ . should ( "have.css" , "position" , "relative" ) ;
409+
410+ // Check that block start padding of the second message is not overridden
411+ cy . get ( ".mx_EventTile.mx_EventTile_continuation" ) . should ( "have.css" , "margin-block-start" , "2px" ) ;
412+
413+ // Select the last bubble
414+ cy . get ( ".mx_EventTile_last" )
415+ . within ( ( ) => {
416+ // calc(var(--gutterSize) - 1px)
417+ cy . get ( ".mx_EventTile_line" ) . should ( "have.css" , "padding-block-start" , "10px" ) ;
418+ } )
419+ . should ( "have.css" , "margin-block-start" , "2px" ) ; // The last bubble is also a continued one
420+ } ) ;
421+
422+ cy . get ( ".mx_MainSplit" ) . percySnapshotElement ( "EventTiles on bubble layout" , { percyCSS } ) ;
423+ } ) ;
424+
308425 it ( "should set inline start padding to a hidden event line" , ( ) => {
309426 sendEvent ( roomId ) ;
310427 cy . visit ( "/#/room/" + roomId ) ;
0 commit comments