review: quick renaming
This commit is contained in:
@@ -144,6 +144,23 @@ test("Should switch back to grid mode when the remote screen share ends", () =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("can auto-switch to spotlight again after first screen share ends", () => {
|
||||||
|
withTestScheduler(({ cold, behavior, expectObservable }): void => {
|
||||||
|
const shareMarble = "ftft";
|
||||||
|
const gridsMarble = "gsgs";
|
||||||
|
const { gridMode$ } = createLayoutModeSwitch(
|
||||||
|
scope,
|
||||||
|
behavior("n", { n: "normal" }),
|
||||||
|
cold(shareMarble, { f: false, t: true }),
|
||||||
|
);
|
||||||
|
|
||||||
|
expectObservable(gridMode$).toBe(gridsMarble, {
|
||||||
|
g: "grid",
|
||||||
|
s: "spotlight",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("can switch manually to grid after screen share while manually in spotlight", () => {
|
test("can switch manually to grid after screen share while manually in spotlight", () => {
|
||||||
withTestScheduler(({ cold, behavior, schedule, expectObservable }): void => {
|
withTestScheduler(({ cold, behavior, schedule, expectObservable }): void => {
|
||||||
// Initially, no one is sharing. Then the user manually switches to
|
// Initially, no one is sharing. Then the user manually switches to
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ export function createLayoutModeSwitch(
|
|||||||
/** Remember if the change was user driven or not */
|
/** Remember if the change was user driven or not */
|
||||||
hasAutoSwitched: boolean;
|
hasAutoSwitched: boolean;
|
||||||
/** To know if it is new screen share or an already handled */
|
/** To know if it is new screen share or an already handled */
|
||||||
prevShare: boolean;
|
hasScreenShares: boolean;
|
||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(acc, [userSelection, hasScreenShares, windowMode]) => {
|
(prev, [userSelection, hasScreenShares, windowMode]) => {
|
||||||
const isFlatMode = windowMode === "flat";
|
const isFlatMode = windowMode === "flat";
|
||||||
|
|
||||||
// Always force spotlight in flat mode, grid layout is not supported
|
// Always force spotlight in flat mode, grid layout is not supported
|
||||||
@@ -78,8 +78,8 @@ export function createLayoutModeSwitch(
|
|||||||
logger.debug(`Forcing spotlight mode, windowMode=${windowMode}`);
|
logger.debug(`Forcing spotlight mode, windowMode=${windowMode}`);
|
||||||
return {
|
return {
|
||||||
mode: "spotlight",
|
mode: "spotlight",
|
||||||
hasAutoSwitched: acc.hasAutoSwitched,
|
hasAutoSwitched: prev.hasAutoSwitched,
|
||||||
prevShare: hasScreenShares,
|
hasScreenShares,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ export function createLayoutModeSwitch(
|
|||||||
if (userSelection === "spotlight") {
|
if (userSelection === "spotlight") {
|
||||||
return {
|
return {
|
||||||
mode: "spotlight",
|
mode: "spotlight",
|
||||||
hasAutoSwitched: acc.hasAutoSwitched,
|
hasAutoSwitched: prev.hasAutoSwitched,
|
||||||
prevShare: hasScreenShares,
|
hasScreenShares,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,12 +97,12 @@ export function createLayoutModeSwitch(
|
|||||||
// auto-switch to spotlight mode for better experience.
|
// auto-switch to spotlight mode for better experience.
|
||||||
// But we only do it once, if the user switches back to grid mode,
|
// But we only do it once, if the user switches back to grid mode,
|
||||||
// we respect that choice until they explicitly change it again.
|
// we respect that choice until they explicitly change it again.
|
||||||
const isNewShare = hasScreenShares && !acc.prevShare;
|
const isNewShare = hasScreenShares && !prev.hasScreenShares;
|
||||||
if (isNewShare && !acc.hasAutoSwitched) {
|
if (isNewShare && !prev.hasAutoSwitched) {
|
||||||
return {
|
return {
|
||||||
mode: "spotlight",
|
mode: "spotlight",
|
||||||
hasAutoSwitched: true,
|
hasAutoSwitched: true,
|
||||||
prevShare: true,
|
hasScreenShares: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,11 +112,11 @@ export function createLayoutModeSwitch(
|
|||||||
return {
|
return {
|
||||||
mode: "grid",
|
mode: "grid",
|
||||||
hasAutoSwitched: false,
|
hasAutoSwitched: false,
|
||||||
prevShare: hasScreenShares,
|
hasScreenShares,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// initial value
|
// initial value
|
||||||
{ mode: "grid", hasAutoSwitched: false, prevShare: false },
|
{ mode: "grid", hasAutoSwitched: false, hasScreenShares: false },
|
||||||
),
|
),
|
||||||
map(({ mode }) => mode),
|
map(({ mode }) => mode),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user