Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 92fce71

Browse files
authored
Align the right edge of info tile lines with normal ones on IRC layout (#9058)
* Apply inline start margin to info event tile line to align the right edge with normal event tile lines Signed-off-by: Suguru Hirahara <[email protected]> * Rename the variable Signed-off-by: Suguru Hirahara <[email protected]> * Add a test to check inline start margin Signed-off-by: Suguru Hirahara <[email protected]> * Rerun CI Signed-off-by: Suguru Hirahara <[email protected]> * Improve tests a little bit Signed-off-by: Suguru Hirahara <[email protected]>
1 parent c5eaeaf commit 92fce71

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

cypress/e2e/14-timeline/timeline.spec.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,32 @@ describe("Timeline", () => {
151151
cy.percySnapshot("Configured room on IRC layout");
152152
});
153153

154+
it("should add inline start margin to an event line on IRC layout", () => {
155+
cy.visit("/#/room/" + roomId);
156+
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
157+
158+
// Wait until configuration is finished
159+
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary " +
160+
".mx_GenericEventListSummary_summary", "created and configured the room.");
161+
162+
// Click "expand" link button
163+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
164+
165+
// Check the event line has margin instead of inset property
166+
// cf. _EventTile.pcss
167+
// --EventTile_irc_line_info-margin-inline-start
168+
// = calc(var(--name-width) + 10px + var(--icon-width))
169+
// = 80 + 10 + 14 = 104px
170+
cy.get(".mx_EventTile[data-layout=irc].mx_EventTile_info:first-of-type .mx_EventTile_line")
171+
.should('have.css', "margin-inline-start", "104px")
172+
.should('have.css', "inset-inline-start", "0px");
173+
174+
// Exclude timestamp from snapshot
175+
const percyCSS = ".mx_RoomView_body .mx_EventTile_info .mx_MessageTimestamp "
176+
+ "{ visibility: hidden !important; }";
177+
cy.percySnapshot("Event line with inline start margin on IRC layout", { percyCSS });
178+
});
179+
154180
it("should click top left of view source event toggle", () => {
155181
sendEvent(roomId);
156182
cy.visit("/#/room/" + roomId);
@@ -159,11 +185,11 @@ describe("Timeline", () => {
159185
".mx_GenericEventListSummary_summary", "created and configured the room.");
160186

161187
// Edit message
162-
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile_line", "Message").within(() => {
188+
cy.contains(".mx_RoomView_body .mx_EventTile .mx_EventTile_line", "Message").within(() => {
163189
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover
164190
cy.get(".mx_BasicMessageComposer_input").type("Edit{enter}");
165191
});
166-
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile[data-scroll-tokens]", "MessageEdit");
192+
cy.contains(".mx_RoomView_body .mx_EventTile[data-scroll-tokens]", "MessageEdit");
167193

168194
// Click top left of the event toggle, which should not be covered by MessageActionBar's safe area
169195
cy.get(".mx_EventTile .mx_ViewSourceEvent").realHover()

res/css/views/rooms/_EventTile.pcss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ $left-gutter: 64px;
274274
}
275275

276276
&[data-layout="irc"] {
277-
--EventTile_irc_line_info-inset-inline-start: calc(var(--name-width) + 10px + var(--icon-width));
277+
--EventTile_irc_line_info-margin-inline-start: calc(var(--name-width) + 10px + var(--icon-width));
278278

279279
.mx_EventTile_msgOption {
280280
.mx_ReadReceiptGroup {
@@ -288,7 +288,7 @@ $left-gutter: 64px;
288288

289289
.mx_EventTileBubble {
290290
position: relative;
291-
left: var(--EventTile_irc_line_info-inset-inline-start);
291+
left: var(--EventTile_irc_line_info-margin-inline-start);
292292

293293
&.mx_cryptoEvent {
294294
left: unset;
@@ -308,11 +308,15 @@ $left-gutter: 64px;
308308

309309
&.mx_EventTile_info {
310310
.mx_EventTile_avatar {
311-
left: var(--EventTile_irc_line_info-inset-inline-start);
311+
left: var(--EventTile_irc_line_info-margin-inline-start);
312312
top: 0;
313313
margin-right: var(--right-padding);
314314
padding-block: var(--EventTile_irc_line-padding-block);
315315
}
316+
317+
.mx_EventTile_line {
318+
margin-inline-start: var(--EventTile_irc_line_info-margin-inline-start);
319+
}
316320
}
317321
}
318322

res/css/views/rooms/_IRCLayout.pcss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ $irc-line-height: $font-18px;
161161
}
162162

163163
.mx_EventTile.mx_EventTile_info {
164-
.mx_EventTile_line {
165-
left: var(--EventTile_irc_line_info-inset-inline-start);
166-
}
167-
168164
.mx_ViewSourceEvent, // For hidden events
169165
.mx_TextualEvent {
170166
line-height: $irc-line-height;

0 commit comments

Comments
 (0)