fix(accounts): stabilize extreme toggle bursts
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
matchesAccountModeFilter,
|
||||
mergeAccountToggleSettings,
|
||||
pruneAccountRowSelection,
|
||||
resolveAccountToggleIntentEnabled,
|
||||
resolveAccountUsername,
|
||||
resolveVisibleAccountKind,
|
||||
sortAccountServices
|
||||
@@ -143,6 +144,12 @@ describe("account usernames", () => {
|
||||
});
|
||||
|
||||
describe("account toggle bursts", () => {
|
||||
it("toggles from the synchronous pending intent when the controlled DOM value lags", () => {
|
||||
expect(resolveAccountToggleIntentEnabled(undefined, false)).toBe(false);
|
||||
expect(resolveAccountToggleIntentEnabled(false, false)).toBe(true);
|
||||
expect(resolveAccountToggleIntentEnabled(true, true)).toBe(false);
|
||||
});
|
||||
|
||||
it("serializes different account intents without dropping the second task", async () => {
|
||||
const queue = createAccountToggleQueue();
|
||||
const events: string[] = [];
|
||||
|
||||
@@ -1356,6 +1356,16 @@ describe("account workspace", () => {
|
||||
});
|
||||
|
||||
describe("settings App integration", () => {
|
||||
it("serializes local and online backup imports with pending account mutations", () => {
|
||||
const localImport = sourceBlock(appSource, "const onImportBackup", "const onCreateOnlineBackup");
|
||||
const onlineImport = sourceBlock(appSource, "const onImportOnlineBackup", "const onCopyOnlineBackupKey");
|
||||
|
||||
expect(localImport).toContain("runQueuedSettingsMutation");
|
||||
expect(onlineImport).toContain("runQueuedSettingsMutation");
|
||||
expect(localImport.indexOf("runQueuedSettingsMutation")).toBeLessThan(localImport.indexOf("runLocalBackupImport"));
|
||||
expect(onlineImport.indexOf("runQueuedSettingsMutation")).toBeLessThan(onlineImport.indexOf("window.rd.importOnlineBackup"));
|
||||
});
|
||||
|
||||
it("projects provider order entries with logos and explicit login modes", () => {
|
||||
const settings = createRendererSettings({
|
||||
...defaultSettings(),
|
||||
|
||||
Reference in New Issue
Block a user