mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-09-17 11:37:10 +03:00
test(action): ✅ add remaining tests
This commit is contained in:
parent
b90a5d49b7
commit
88a2ea2d0c
@ -279,4 +279,81 @@ describe("action", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("toggle floating", () => {
|
||||
it("executes correctly", () => {
|
||||
const fakeCurrentWindow = createMock<Window>();
|
||||
const fakeEngine = createMock<Engine>({
|
||||
toggleFloat: jest.fn(),
|
||||
currentWindow: jest.fn().mockReturnValue(fakeCurrentWindow),
|
||||
});
|
||||
|
||||
const action = new Action.ToggleActiveWindowFloating(fakeEngine);
|
||||
|
||||
action.execute();
|
||||
|
||||
expect(fakeEngine.toggleFloat).toBeCalledWith(fakeCurrentWindow);
|
||||
});
|
||||
});
|
||||
|
||||
describe("push window into master area", () => {
|
||||
it("executes correctly", () => {
|
||||
const fakeCurrentWindow = createMock<Window>();
|
||||
const fakeEngine = createMock<Engine>({
|
||||
setMaster: jest.fn(),
|
||||
currentWindow: jest.fn().mockReturnValue(fakeCurrentWindow),
|
||||
});
|
||||
|
||||
const action = new Action.PushActiveWindowIntoMasterAreaFront(fakeEngine);
|
||||
|
||||
action.execute();
|
||||
|
||||
expect(fakeEngine.setMaster).toBeCalledWith(fakeCurrentWindow);
|
||||
});
|
||||
});
|
||||
|
||||
describe("layout switching", () => {
|
||||
let fakeEngine: Engine;
|
||||
let fakeCurrentWindow: Window;
|
||||
|
||||
beforeEach(() => {
|
||||
fakeCurrentWindow = createMock<Window>();
|
||||
|
||||
fakeEngine = createMock<Engine>({
|
||||
cycleLayout: jest.fn(),
|
||||
setLayout: jest.fn(),
|
||||
currentWindow: jest.fn().mockReturnValue(fakeCurrentWindow),
|
||||
});
|
||||
});
|
||||
|
||||
describe("next layout", () => {
|
||||
it("executes correctly", () => {
|
||||
const action = new Action.SwitchToNextLayout(fakeEngine);
|
||||
|
||||
action.execute();
|
||||
|
||||
expect(fakeEngine.cycleLayout).toBeCalledWith(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("prev layout", () => {
|
||||
it("executes correctly", () => {
|
||||
const action = new Action.SwitchToPreviousLayout(fakeEngine);
|
||||
|
||||
action.execute();
|
||||
|
||||
expect(fakeEngine.cycleLayout).toBeCalledWith(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("set layout", () => {
|
||||
it("executes correctly when asking to set Monocle Layout", () => {
|
||||
const action = new Action.SetMonocleLayout(fakeEngine);
|
||||
|
||||
action.execute();
|
||||
|
||||
expect(fakeEngine.setLayout).toBeCalledWith("MonocleLayout");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user