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

Commit 8e1b9f4

Browse files
luixxiulgermain-gg
andauthored
Set expected value of line-height to expanded generic event list summary (GELS) spacer on IRC layout (#10211)
* Set expected line height to an expanded GELS line on IRC layout, add a test * Add a test for compact modern/group layout * Create a new test category on timeline.spec.ts * Rename the class name as 'spacer' * Add a test for GELS' spacer on bubble layout --------- Signed-off-by: Suguru Hirahara <[email protected]> Co-authored-by: Germain <[email protected]>
1 parent 75f31de commit 8e1b9f4

File tree

4 files changed

+101
-11
lines changed

4 files changed

+101
-11
lines changed

cypress/e2e/timeline/timeline.spec.ts

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ describe("Timeline", () => {
147147
});
148148
});
149149

150-
describe("message displaying", () => {
150+
describe("configure room", () => {
151+
// Exclude timestamp and read marker from snapshots
152+
const percyCSS = ".mx_MessageTimestamp, .mx_RoomView_myReadMarker { visibility: hidden !important; }";
153+
151154
beforeEach(() => {
152155
cy.injectAxe();
153156
});
@@ -182,6 +185,65 @@ describe("Timeline", () => {
182185
cy.get(".mx_MainSplit").percySnapshotElement("Configured room on IRC layout");
183186
});
184187

188+
it("should have an expanded generic event list summary (GELS) on IRC layout", () => {
189+
cy.visit("/#/room/" + roomId);
190+
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
191+
192+
// Wait until configuration is finished
193+
cy.contains(
194+
".mx_RoomView_body .mx_GenericEventListSummary .mx_GenericEventListSummary_summary",
195+
"created and configured the room.",
196+
).should("exist");
197+
198+
// Click "expand" link button
199+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
200+
201+
// Make sure the "expand" link button worked
202+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").should("exist");
203+
204+
// Check the height of expanded GELS line
205+
cy.get(".mx_GenericEventListSummary[data-layout=irc] .mx_GenericEventListSummary_spacer").should(
206+
"have.css",
207+
"line-height",
208+
"18px", // $irc-line-height: $font-18px (See: _IRCLayout.pcss)
209+
);
210+
211+
cy.get(".mx_MainSplit").percySnapshotElement("Expanded GELS on IRC layout", { percyCSS });
212+
});
213+
214+
it("should have an expanded generic event list summary (GELS) on compact modern/group layout", () => {
215+
cy.visit("/#/room/" + roomId);
216+
217+
// Set compact modern layout
218+
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Group).setSettingValue(
219+
"useCompactLayout",
220+
null,
221+
SettingLevel.DEVICE,
222+
true,
223+
);
224+
225+
// Wait until configuration is finished
226+
cy.contains(
227+
".mx_RoomView_body .mx_GenericEventListSummary .mx_GenericEventListSummary_summary",
228+
"created and configured the room.",
229+
).should("exist");
230+
231+
// Click "expand" link button
232+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
233+
234+
// Make sure the "expand" link button worked
235+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").should("exist");
236+
237+
// Check the height of expanded GELS line
238+
cy.get(".mx_GenericEventListSummary[data-layout=group] .mx_GenericEventListSummary_spacer").should(
239+
"have.css",
240+
"line-height",
241+
"22px", // $font-22px (See: _GenericEventListSummary.pcss)
242+
);
243+
244+
cy.get(".mx_MainSplit").percySnapshotElement("Expanded GELS on modern layout", { percyCSS });
245+
});
246+
185247
it("should add inline start margin to an event line on IRC layout", () => {
186248
cy.visit("/#/room/" + roomId);
187249
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
@@ -212,6 +274,12 @@ describe("Timeline", () => {
212274
});
213275
cy.checkA11y();
214276
});
277+
});
278+
279+
describe("message displaying", () => {
280+
beforeEach(() => {
281+
cy.injectAxe();
282+
});
215283

216284
it("should align generic event list summary with messages and emote on IRC layout", () => {
217285
// This test aims to check:
@@ -569,12 +637,29 @@ describe("Timeline", () => {
569637
// Click "expand" link button
570638
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
571639

640+
// Make sure the "expand" link button worked
641+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").should("exist");
642+
643+
// Make sure spacer is not visible on bubble layout
644+
cy.get(".mx_GenericEventListSummary[data-layout=bubble] .mx_GenericEventListSummary_spacer").should(
645+
"not.be.visible", // See: _GenericEventListSummary.pcss
646+
);
647+
648+
// Exclude timestamp from snapshot
649+
const percyCSS = ".mx_MessageTimestamp { visibility: hidden !important; }";
650+
651+
// Save snapshot of expanded generic event list summary on bubble layout
652+
cy.get(".mx_MainSplit").percySnapshotElement("Expanded GELS on bubble layout", { percyCSS });
653+
572654
// Click "collapse" link button on the first hovered info event line
573655
cy.get(".mx_GenericEventListSummary_unstyledList .mx_EventTile_info:first-of-type").realHover();
574656
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").click({ force: false });
575657

576658
// Make sure "collapse" link button worked
577659
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").should("exist");
660+
661+
// Save snapshot of collapsed generic event list summary on bubble layout
662+
cy.get(".mx_MainSplit").percySnapshotElement("Collapsed GELS on bubble layout", { percyCSS });
578663
});
579664

580665
it("should highlight search result words regardless of formatting", () => {

res/css/views/elements/_GenericEventListSummary.pcss

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ limitations under the License.
2121
margin-right: $spacing-8;
2222
}
2323

24+
.mx_GenericEventListSummary_spacer {
25+
border-bottom: 1px solid $primary-hairline-color;
26+
margin-left: 63px; /* TODO: Use a variable */
27+
line-height: $font-30px; /* TODO: Use a variable */
28+
29+
.mx_IRCLayout & {
30+
line-height: var(--line-height);
31+
}
32+
}
33+
2434
&[data-layout="irc"],
2535
&[data-layout="group"] {
2636
.mx_GenericEventListSummary_toggle {
@@ -51,7 +61,7 @@ limitations under the License.
5161
}
5262
}
5363

54-
.mx_GenericEventListSummary_line {
64+
.mx_GenericEventListSummary_spacer {
5565
display: none;
5666
}
5767

@@ -88,7 +98,7 @@ limitations under the License.
8898
line-height: $font-20px;
8999
}
90100

91-
.mx_GenericEventListSummary_line {
101+
.mx_GenericEventListSummary_spacer {
92102
line-height: $font-22px;
93103
}
94104

@@ -117,9 +127,3 @@ limitations under the License.
117127
cursor: pointer;
118128
}
119129
}
120-
121-
.mx_GenericEventListSummary_line {
122-
border-bottom: 1px solid $primary-hairline-color;
123-
margin-left: 63px;
124-
line-height: $font-30px;
125-
}

res/css/views/rooms/_IRCLayout.pcss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ $irc-line-height: $font-18px;
2020
--name-width: 80px; // cf. ircDisplayNameWidth on Settings.tsx
2121
--icon-width: 14px;
2222
--right-padding: 5px;
23+
--line-height: $irc-line-height;
2324

24-
line-height: $irc-line-height !important;
25+
line-height: var(--line-height) !important;
2526

2627
.mx_NewRoomIntro {
2728
> h2 {

src/components/views/elements/GenericEventListSummary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const GenericEventListSummary: React.FC<IProps> = ({
8686
if (expanded) {
8787
body = (
8888
<React.Fragment>
89-
<div className="mx_GenericEventListSummary_line">&nbsp;</div>
89+
<div className="mx_GenericEventListSummary_spacer">&nbsp;</div>
9090
<ol className="mx_GenericEventListSummary_unstyledList">{children}</ol>
9191
</React.Fragment>
9292
);

0 commit comments

Comments
 (0)