jazz-tools 0.13.10 → 0.13.11

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.
@@ -36,10 +36,10 @@ describe("CoPlainText", () => {
36
36
  test("insertion", () => {
37
37
  const text = CoPlainText.create("hello world", { owner: me });
38
38
 
39
- text.insertAfter(5, " cruel");
39
+ text.insertAfter(4, " cruel");
40
40
  expect(text + "").toEqual("hello cruel world");
41
41
 
42
- text.insertAfter(0, "Hello, ");
42
+ text.insertBefore(0, "Hello, ");
43
43
  expect(text + "").toEqual("Hello, hello cruel world");
44
44
  });
45
45
 
@@ -49,6 +49,24 @@ describe("CoPlainText", () => {
49
49
  text.deleteRange({ from: 3, to: 8 });
50
50
  expect(text + "").toEqual("helrld");
51
51
  });
52
+
53
+ test("applyDiff", () => {
54
+ const text = CoPlainText.create("hello world", { owner: me });
55
+ text.applyDiff("hello cruel world");
56
+ expect(text.toString()).toEqual("hello cruel world");
57
+ });
58
+ });
59
+
60
+ describe("Properties", () => {
61
+ test("length", () => {
62
+ const text = CoPlainText.create("hello world", { owner: me });
63
+ expect(text.length).toBe(11);
64
+ });
65
+
66
+ test("toString", () => {
67
+ const text = CoPlainText.create("hello world", { owner: me });
68
+ expect(text.toString()).toBe("hello world");
69
+ });
52
70
  });
53
71
 
54
72
  describe("Position operations", () => {
@@ -155,7 +173,7 @@ describe("CoPlainText", () => {
155
173
  expect(update1.toString()).toBe("hello world");
156
174
 
157
175
  // When we make a change, we should get an update
158
- text.insertAfter(5, " beautiful");
176
+ text.insertAfter(4, " beautiful");
159
177
  const update2 = (await queue.next()).value;
160
178
  expect(update2.toString()).toBe("hello beautiful world");
161
179
 
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=coRichText.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coRichText.test.d.ts","sourceRoot":"","sources":["../../src/tests/coRichText.test.ts"],"names":[],"mappings":""}