summaryrefslogtreecommitdiff
path: root/packages/web/src/doc/index.test.ts
blob: 5f61398e23e51bf48cf9810e3206cbdccf5ae5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { expect, test } from "vitest";
import { apply, defaultDoc, realizeGrids, subdivide } from ".";

test(realizeGrids, () => {
  const doc = defaultDoc();
  const grids = realizeGrids(doc);

  expect(grids.length).toBe(1);
  expect(grids[0].rows.length).toBe(4);
  expect(grids[0].rows[0].cells.length).toBe(16);

  const doc2 = apply(doc, subdivide(grids[0].id, 0, 0, 3, 3));
  const grids2 = realizeGrids(doc2);

  expect(grids2[0].rows[0].cells.length).toBe(15);
});