mirror of https://github.com/vector-im/riot-web
Reduce height of toggle on expanded view source event (#10283)
* Reduce height of toggle on expanded view source event Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Add a test to check size and position of toggle on expanded view source event Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> --------- Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>pull/28217/head
parent
4f5a65f548
commit
94950c6987
|
@ -351,6 +351,9 @@ describe("Timeline", () => {
|
||||||
// 1. clickability of top left of view source event toggle
|
// 1. clickability of top left of view source event toggle
|
||||||
// 2. clickability of view source toggle on IRC layout
|
// 2. clickability of view source toggle on IRC layout
|
||||||
|
|
||||||
|
// Exclude timestamp from snapshot
|
||||||
|
const percyCSS = ".mx_MessageTimestamp { visibility: hidden !important; }";
|
||||||
|
|
||||||
sendEvent(roomId);
|
sendEvent(roomId);
|
||||||
cy.visit("/#/room/" + roomId);
|
cy.visit("/#/room/" + roomId);
|
||||||
cy.setSettingValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true);
|
cy.setSettingValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true);
|
||||||
|
@ -376,26 +379,29 @@ describe("Timeline", () => {
|
||||||
cy.get(".mx_ViewSourceEvent_toggle").click("topLeft", { force: false });
|
cy.get(".mx_ViewSourceEvent_toggle").click("topLeft", { force: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Make sure the expand toggle worked
|
// Make sure the expand toggle works
|
||||||
cy.get(".mx_EventTile .mx_ViewSourceEvent_expanded").should("be.visible");
|
cy.get(".mx_EventTile_last[data-layout=group] .mx_ViewSourceEvent_expanded")
|
||||||
|
.should("be.visible")
|
||||||
// Click again to collapse the source
|
|
||||||
cy.get(".mx_EventTile_last[data-layout=group] .mx_ViewSourceEvent")
|
|
||||||
.should("exist")
|
|
||||||
.realHover()
|
.realHover()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(".mx_ViewSourceEvent_toggle").click("topLeft", { force: false });
|
cy.get(".mx_ViewSourceEvent_toggle")
|
||||||
|
// Check size and position of toggle on expanded view source event
|
||||||
|
// See: _ViewSourceEvent.pcss
|
||||||
|
.should("have.css", "height", "12px") // --ViewSourceEvent_toggle-size
|
||||||
|
.should("have.css", "align-self", "flex-end")
|
||||||
|
|
||||||
|
// Click again to collapse the source
|
||||||
|
.click("topLeft", { force: false });
|
||||||
});
|
});
|
||||||
cy.get(".mx_EventTile .mx_ViewSourceEvent_expanded").should("not.exist");
|
|
||||||
|
// Make sure the collapse toggle works
|
||||||
|
cy.get(".mx_EventTile_last[data-layout=group] .mx_ViewSourceEvent_expanded").should("not.exist");
|
||||||
|
|
||||||
// 2. clickability of view source toggle on IRC layout
|
// 2. clickability of view source toggle on IRC layout
|
||||||
|
|
||||||
// Enable IRC layout
|
// Enable IRC layout
|
||||||
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
|
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
|
||||||
|
|
||||||
// Exclude timestamp from snapshot
|
|
||||||
const percyCSS = ".mx_MessageTimestamp { visibility: hidden !important; }";
|
|
||||||
|
|
||||||
// Hover the view source toggle on IRC layout
|
// Hover the view source toggle on IRC layout
|
||||||
cy.get(".mx_GenericEventListSummary[data-layout=irc] .mx_EventTile .mx_ViewSourceEvent")
|
cy.get(".mx_GenericEventListSummary[data-layout=irc] .mx_EventTile .mx_ViewSourceEvent")
|
||||||
.should("exist")
|
.should("exist")
|
||||||
|
|
|
@ -29,32 +29,34 @@ limitations under the License.
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
margin: 3.5px 0;
|
margin: 3.5px 0; /* TODO: use a variable */
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ViewSourceEvent_toggle {
|
.mx_ViewSourceEvent_toggle {
|
||||||
|
--ViewSourceEvent_toggle-size: 12px;
|
||||||
|
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
/* override styles from AccessibleButton */
|
/* override styles from AccessibleButton */
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
/* icon */
|
/* icon */
|
||||||
mask-repeat: no-repeat;
|
mask-repeat: no-repeat;
|
||||||
mask-position: 0 center;
|
mask-position: 0 center;
|
||||||
mask-size: auto 12px;
|
mask-size: auto var(--ViewSourceEvent_toggle-size);
|
||||||
width: 12px;
|
width: var(--ViewSourceEvent_toggle-size);
|
||||||
min-width: 12px;
|
min-width: var(--ViewSourceEvent_toggle-size);
|
||||||
background-color: $accent;
|
background-color: $accent;
|
||||||
mask-image: url("$(res)/img/element-icons/maximise-expand.svg");
|
mask-image: url("$(res)/img/element-icons/maximise-expand.svg");
|
||||||
|
|
||||||
|
.mx_EventTile:hover & {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.mx_ViewSourceEvent_expanded .mx_ViewSourceEvent_toggle {
|
&.mx_ViewSourceEvent_expanded .mx_ViewSourceEvent_toggle {
|
||||||
|
align-self: flex-end;
|
||||||
|
height: var(--ViewSourceEvent_toggle-size);
|
||||||
mask-position: 0 bottom;
|
mask-position: 0 bottom;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px; /* TODO: use a variable */
|
||||||
mask-image: url("$(res)/img/element-icons/minimise-collapse.svg");
|
mask-image: url("$(res)/img/element-icons/minimise-collapse.svg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_EventTile:hover {
|
|
||||||
.mx_ViewSourceEvent_toggle {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue