F1: conflict toast closes when the merge ends, toasts keep off the commit box

The merge store dismisses its conflict warning once the status lists no
conflicted file (resolved, committed or aborted) and replaces it on a new
conflicted merge. The toast stack moves above areas registered with
keepClearOf; the Changes window registers its commit box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 18:53:08 +01:00
parent e228d11ef9
commit 750ecf5e51
7 changed files with 235 additions and 9 deletions

View file

@ -3,7 +3,8 @@
* a toast, auto-dismiss of info toasts with fake timers, the overflow into
* "+n more", ARIA roles, keyboard closing, engine `notification` and
* `watchFailed` events (including untrusted fields), and the replay
* duplicate guard.
* duplicate guard, and keeping the stack off registered areas such as the
* commit box.
*/
import { mount, type VueWrapper } from "@vue/test-utils";
import { createPinia, setActivePinia, type Pinia } from "pinia";
@ -21,6 +22,8 @@ import {
MAX_VISIBLE,
notificationFromEvent,
notificationText,
STACK_BOTTOM,
stackBottom,
useNotificationsStore,
} from "../../src/stores/notifications";
@ -277,3 +280,33 @@ describe("NotificationStack", () => {
expect(stack.find('[data-test="toast"]').exists()).toBe(false);
});
});
describe("keeping areas clear", () => {
it("places the stack above an area it would cover, and ignores hidden or distant ones", () => {
const box = { left: 0, right: 1000, top: 700, bottom: 780 };
expect(stackBottom(1000, 800, [])).toBe(STACK_BOTTOM);
expect(stackBottom(1000, 800, [box])).toBe(108);
expect(stackBottom(1000, 800, [{ left: 0, right: 0, top: 0, bottom: 0 }])).toBe(STACK_BOTTOM);
expect(stackBottom(1000, 800, [{ ...box, right: 500 }])).toBe(STACK_BOTTOM);
expect(stackBottom(1000, 800, [box, { ...box, top: 600 }])).toBe(208);
});
it("moves the shown stack above a registered element until it is released", async () => {
Object.assign(window, { innerWidth: 1000, innerHeight: 800 });
const store = useNotificationsStore();
const commit = document.createElement("form");
commit.getBoundingClientRect = () => new DOMRect(0, 700, 1000, 80);
document.body.append(commit);
store.notify({ level: "warning", message: "conflicts" });
const stack = mountStack();
await stack.vm.$nextTick();
expect(stack.get('[data-test="toasts"]').attributes("style")).toContain(`bottom: ${String(STACK_BOTTOM)}px`);
const release = store.keepClearOf(commit);
await stack.vm.$nextTick();
expect(stack.get('[data-test="toasts"]').attributes("style")).toContain("bottom: 108px");
release();
await stack.vm.$nextTick();
expect(stack.get('[data-test="toasts"]').attributes("style")).toContain(`bottom: ${String(STACK_BOTTOM)}px`);
commit.remove();
});
});