mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Send to back (#98)
This commit is contained in:
parent
b1a90c0020
commit
0d5272720f
3 changed files with 180 additions and 1 deletions
51
src/zindex.test.ts
Normal file
51
src/zindex.test.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { moveOneLeft, moveAllLeft } from "./zindex";
|
||||
|
||||
function expectMove(fn, elems, indices, equal) {
|
||||
fn(elems, indices);
|
||||
expect(elems).toEqual(equal);
|
||||
}
|
||||
|
||||
it("should moveOneLeft", () => {
|
||||
expectMove(moveOneLeft, ["a", "b", "c", "d"], [1, 2], ["b", "c", "a", "d"]);
|
||||
expectMove(moveOneLeft, ["a", "b", "c", "d"], [0], ["a", "b", "c", "d"]);
|
||||
expectMove(
|
||||
moveOneLeft,
|
||||
["a", "b", "c", "d"],
|
||||
[0, 1, 2, 3],
|
||||
["a", "b", "c", "d"]
|
||||
);
|
||||
expectMove(moveOneLeft, ["a", "b", "c", "d"], [1, 3], ["b", "a", "d", "c"]);
|
||||
});
|
||||
|
||||
it("should moveAllLeft", () => {
|
||||
expectMove(
|
||||
moveAllLeft,
|
||||
["a", "b", "c", "d", "e", "f", "g"],
|
||||
[2, 5],
|
||||
["c", "f", "a", "b", "d", "e", "g"]
|
||||
);
|
||||
expectMove(
|
||||
moveAllLeft,
|
||||
["a", "b", "c", "d", "e", "f", "g"],
|
||||
[5],
|
||||
["f", "a", "b", "c", "d", "e", "g"]
|
||||
);
|
||||
expectMove(
|
||||
moveAllLeft,
|
||||
["a", "b", "c", "d", "e", "f", "g"],
|
||||
[0, 1, 2, 3, 4, 5, 6],
|
||||
["a", "b", "c", "d", "e", "f", "g"]
|
||||
);
|
||||
expectMove(
|
||||
moveAllLeft,
|
||||
["a", "b", "c", "d", "e", "f", "g"],
|
||||
[0, 1, 2],
|
||||
["a", "b", "c", "d", "e", "f", "g"]
|
||||
);
|
||||
expectMove(
|
||||
moveAllLeft,
|
||||
["a", "b", "c", "d", "e", "f", "g"],
|
||||
[4, 5, 6],
|
||||
["e", "f", "g", "a", "b", "c", "d"]
|
||||
);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue