Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -45,8 +45,8 @@ describe("RightPanelStore", () => {
|
|||
});
|
||||
|
||||
const viewRoom = async (roomId: string) => {
|
||||
const roomChanged = new Promise<void>(resolve => {
|
||||
const ref = defaultDispatcher.register(payload => {
|
||||
const roomChanged = new Promise<void>((resolve) => {
|
||||
const ref = defaultDispatcher.register((payload) => {
|
||||
if (payload.action === Action.ActiveRoomChanged && payload.newRoomId === roomId) {
|
||||
defaultDispatcher.unregister(ref);
|
||||
resolve();
|
||||
|
@ -113,9 +113,7 @@ describe("RightPanelStore", () => {
|
|||
await viewRoom("!1:example.org");
|
||||
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
|
||||
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
|
||||
expect(store.roomPhaseHistory).toEqual([
|
||||
{ phase: RightPanelPhases.RoomSummary, state: {} },
|
||||
]);
|
||||
expect(store.roomPhaseHistory).toEqual([{ phase: RightPanelPhases.RoomSummary, state: {} }]);
|
||||
});
|
||||
it("opens the panel in the given room with the correct phase", () => {
|
||||
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
|
||||
|
@ -126,9 +124,7 @@ describe("RightPanelStore", () => {
|
|||
await viewRoom("!1:example.org");
|
||||
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
|
||||
store.setCard({ phase: RightPanelPhases.RoomMemberList }, true, "!1:example.org");
|
||||
expect(store.roomPhaseHistory).toEqual([
|
||||
{ phase: RightPanelPhases.RoomMemberList, state: {} },
|
||||
]);
|
||||
expect(store.roomPhaseHistory).toEqual([{ phase: RightPanelPhases.RoomMemberList, state: {} }]);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -136,10 +132,11 @@ describe("RightPanelStore", () => {
|
|||
it("overwrites history", async () => {
|
||||
await viewRoom("!1:example.org");
|
||||
store.setCard({ phase: RightPanelPhases.RoomMemberList }, true, "!1:example.org");
|
||||
store.setCards([
|
||||
{ phase: RightPanelPhases.RoomSummary },
|
||||
{ phase: RightPanelPhases.PinnedMessages },
|
||||
], true, "!1:example.org");
|
||||
store.setCards(
|
||||
[{ phase: RightPanelPhases.RoomSummary }, { phase: RightPanelPhases.PinnedMessages }],
|
||||
true,
|
||||
"!1:example.org",
|
||||
);
|
||||
expect(store.roomPhaseHistory).toEqual([
|
||||
{ phase: RightPanelPhases.RoomSummary, state: {} },
|
||||
{ phase: RightPanelPhases.PinnedMessages, state: {} },
|
||||
|
@ -171,10 +168,11 @@ describe("RightPanelStore", () => {
|
|||
|
||||
describe("popCard", () => {
|
||||
it("removes the most recent card", () => {
|
||||
store.setCards([
|
||||
{ phase: RightPanelPhases.RoomSummary },
|
||||
{ phase: RightPanelPhases.PinnedMessages },
|
||||
], true, "!1:example.org");
|
||||
store.setCards(
|
||||
[{ phase: RightPanelPhases.RoomSummary }, { phase: RightPanelPhases.PinnedMessages }],
|
||||
true,
|
||||
"!1:example.org",
|
||||
);
|
||||
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.PinnedMessages);
|
||||
store.popCard("!1:example.org");
|
||||
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.RoomSummary);
|
||||
|
@ -208,15 +206,19 @@ describe("RightPanelStore", () => {
|
|||
|
||||
it("doesn't restore member info cards when switching back to a room", async () => {
|
||||
await viewRoom("!1:example.org");
|
||||
store.setCards([
|
||||
{
|
||||
phase: RightPanelPhases.RoomMemberList,
|
||||
},
|
||||
{
|
||||
phase: RightPanelPhases.RoomMemberInfo,
|
||||
state: { member: new RoomMember("!1:example.org", "@alice:example.org") },
|
||||
},
|
||||
], true, "!1:example.org");
|
||||
store.setCards(
|
||||
[
|
||||
{
|
||||
phase: RightPanelPhases.RoomMemberList,
|
||||
},
|
||||
{
|
||||
phase: RightPanelPhases.RoomMemberInfo,
|
||||
state: { member: new RoomMember("!1:example.org", "@alice:example.org") },
|
||||
},
|
||||
],
|
||||
true,
|
||||
"!1:example.org",
|
||||
);
|
||||
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.RoomMemberInfo);
|
||||
|
||||
// Switch away and back
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue