diff --git a/src/state/CallViewModel/LayoutSwitch.test.ts b/src/state/CallViewModel/LayoutSwitch.test.ts index 57df5563..d0034743 100644 --- a/src/state/CallViewModel/LayoutSwitch.test.ts +++ b/src/state/CallViewModel/LayoutSwitch.test.ts @@ -101,21 +101,24 @@ test("Can manually force grid when there is a screenshare", () => { }); }); -test("Should not auto-switch after manually selected grid", () => { +test("Should auto-switch after manually selected grid", () => { withTestScheduler(({ cold, behavior, expectObservable, schedule }): void => { const { gridMode$, setGridMode } = createLayoutModeSwitch( scope, behavior("n", { n: "normal" }), + // Two screenshares will happen in sequence cold("-ft-ft", { f: false, t: true }), ); + // There was a screen-share that forced spotlight, then + // the user manually switch back to grid schedule("---g", { g: () => setGridMode("grid"), }); - const expectation = "ggsg"; - // If we did not respect manual selection, the expectation would be: - // const expectation = "ggsg-s"; + // If we did want to respect manual selection, the expectation would be: + // const expectation = "ggsg"; + const expectation = "ggsg-s"; expectObservable(gridMode$).toBe(expectation, { g: "grid", diff --git a/src/state/CallViewModel/LayoutSwitch.ts b/src/state/CallViewModel/LayoutSwitch.ts index c7a1e631..cfb31d53 100644 --- a/src/state/CallViewModel/LayoutSwitch.ts +++ b/src/state/CallViewModel/LayoutSwitch.ts @@ -97,9 +97,9 @@ export function createLayoutModeSwitch( } // Respect user's grid choice - // XXX If we want to allow switching automatically again after we can - // return hasAutoSwitched: false here instead of keeping the previous value. - return { mode: "grid", hasAutoSwitched: acc.hasAutoSwitched }; + // XXX If we want to forbid switching automatically again after we can + // return hasAutoSwitched: acc.hasAutoSwitched here instead of setting to false. + return { mode: "grid", hasAutoSwitched: false }; }, // initial value { mode: "grid", hasAutoSwitched: false },