Browse Source

Fix completer model tests.

Afshin Darian 8 years ago
parent
commit
67ec5222e4
2 changed files with 7 additions and 10 deletions
  1. 1 1
      test/src/completer/handler.spec.ts
  2. 6 9
      test/src/completer/model.spec.ts

+ 1 - 1
test/src/completer/handler.spec.ts

@@ -437,7 +437,7 @@ describe('completer/handler', () => {
         let text = 'eggs\nfoo # comment\nbaz';
         let want = 'eggs\nfoobar # comment\nbaz';
         let request: CompleterWidget.ITextState = {
-          column: 2,
+          column: 5,
           line: 1,
           lineHeight: 0,
           charWidth: 0,

+ 6 - 9
test/src/completer/model.spec.ts

@@ -6,7 +6,7 @@ import expect = require('expect.js');
 import {
   toArray
 } from 'phosphor/lib/algorithm/iteration';
-//
+
 import {
   CompleterModel, CompleterWidget
 } from '../../../lib/completer';
@@ -359,8 +359,7 @@ describe('completer/model', () => {
         let patch = 'foobar';
         let want: CompleterWidget.IPatch = {
           text: patch,
-          start: 0,
-          end: 3
+          offset: patch.length
         };
         let cursor: CompleterWidget.ICursorSpan = { start: 0, end: 3 };
         model.original = makeState('foo');
@@ -377,13 +376,11 @@ describe('completer/model', () => {
         let model = new CompleterModel();
         let currentValue = 'foo\nbar';
         let patch = 'barbaz';
-        let wantText = 'barbaz';
-        let start = 10;
-        let end = wantText.length;
+        let start = currentValue.length;
+        let end = currentValue.length;
         let want: CompleterWidget.IPatch = {
-          text: wantText,
-          start,
-          end
+          text: currentValue + patch,
+          offset: currentValue.length + patch.length
         };
         let cursor: CompleterWidget.ICursorSpan = { start, end };
         model.original = makeState(currentValue);