feat: auto-show PR details panel when task has associated PR (#517)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { shouldAutoAddPRPanel } from "../dockview-session-tabs";
|
||||
|
||||
describe("shouldAutoAddPRPanel", () => {
|
||||
const base = {
|
||||
hasPR: true,
|
||||
panelExists: false,
|
||||
isRestoringLayout: false,
|
||||
isMaximized: false,
|
||||
};
|
||||
|
||||
it("returns 'add' when task has PR and panel does not exist", () => {
|
||||
expect(shouldAutoAddPRPanel(base)).toBe("add");
|
||||
});
|
||||
|
||||
it("returns 'none' when task has no PR", () => {
|
||||
expect(shouldAutoAddPRPanel({ ...base, hasPR: false })).toBe("none");
|
||||
});
|
||||
|
||||
it("returns 'none' when panel already exists", () => {
|
||||
expect(shouldAutoAddPRPanel({ ...base, panelExists: true })).toBe("none");
|
||||
});
|
||||
|
||||
it("returns 'none' during layout restoration", () => {
|
||||
expect(shouldAutoAddPRPanel({ ...base, isRestoringLayout: true })).toBe("none");
|
||||
});
|
||||
|
||||
it("returns 'none' during maximize state", () => {
|
||||
expect(shouldAutoAddPRPanel({ ...base, isMaximized: true })).toBe("none");
|
||||
});
|
||||
|
||||
it("returns 'add' when all conditions are met", () => {
|
||||
expect(
|
||||
shouldAutoAddPRPanel({
|
||||
hasPR: true,
|
||||
panelExists: false,
|
||||
isRestoringLayout: false,
|
||||
isMaximized: false,
|
||||
}),
|
||||
).toBe("add");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user