@window-splitter/state 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -9
- package/CHANGELOG.md +29 -0
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +32 -12
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +32 -12
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +41 -16
- package/src/machine.test.ts +30 -2
package/src/machine.test.ts
CHANGED
|
@@ -372,7 +372,12 @@ describe("constraints", () => {
|
|
|
372
372
|
],
|
|
373
373
|
},
|
|
374
374
|
}).start();
|
|
375
|
+
|
|
375
376
|
initializeSizes(actor, { width: 500, height: 200 });
|
|
377
|
+
expect(spy).toHaveBeenCalledWith({
|
|
378
|
+
percentage: 0.5,
|
|
379
|
+
pixel: 250,
|
|
380
|
+
});
|
|
376
381
|
|
|
377
382
|
capturePixelValues(actor, () => {
|
|
378
383
|
dragHandle(actor, { id: "resizer-1", delta: 100 });
|
|
@@ -464,7 +469,7 @@ describe("constraints", () => {
|
|
|
464
469
|
}).start();
|
|
465
470
|
|
|
466
471
|
expect(getTemplate(actor)).toMatchInlineSnapshot(
|
|
467
|
-
`"minmax(0px, 90%) 10px 30
|
|
472
|
+
`"minmax(0px, 90%) 10px minmax(30%, 1fr)"`
|
|
468
473
|
);
|
|
469
474
|
initializeSizes(actor, { width: 500, height: 200 });
|
|
470
475
|
|
|
@@ -474,6 +479,29 @@ describe("constraints", () => {
|
|
|
474
479
|
});
|
|
475
480
|
});
|
|
476
481
|
|
|
482
|
+
test("supports 1 panel being collapsed with another panel expanding to fill", () => {
|
|
483
|
+
const actor = createActor(groupMachine, {
|
|
484
|
+
input: {
|
|
485
|
+
groupId: "group",
|
|
486
|
+
initialItems: [
|
|
487
|
+
initializePanel({ id: "panel-1", default: "200px", min: "200px" }),
|
|
488
|
+
initializePanelHandleData({ id: "resizer-1", size: "10px" }),
|
|
489
|
+
initializePanel({
|
|
490
|
+
id: "panel-2",
|
|
491
|
+
min: "200px",
|
|
492
|
+
collapsible: true,
|
|
493
|
+
collapsedSize: "60px",
|
|
494
|
+
defaultCollapsed: true,
|
|
495
|
+
}),
|
|
496
|
+
],
|
|
497
|
+
},
|
|
498
|
+
}).start();
|
|
499
|
+
|
|
500
|
+
expect(getTemplate(actor)).toMatchInlineSnapshot(
|
|
501
|
+
`"minmax(200px, 1fr) 10px 60px"`
|
|
502
|
+
);
|
|
503
|
+
});
|
|
504
|
+
|
|
477
505
|
test("panel can have a min", () => {
|
|
478
506
|
const actor = createActor(groupMachine, {
|
|
479
507
|
input: { groupId: "group" },
|
|
@@ -727,7 +755,7 @@ describe("collapsible panel", () => {
|
|
|
727
755
|
capturePixelValues(actor, () => {
|
|
728
756
|
expect(getTemplate(actor)).toBe("490px 10px 0px");
|
|
729
757
|
|
|
730
|
-
// Stays
|
|
758
|
+
// Stays collapsed in the buffer
|
|
731
759
|
dragHandle(actor, { id: "resizer-1", delta: -30 });
|
|
732
760
|
expect(getTemplate(actor)).toBe("490px 10px 0px");
|
|
733
761
|
|