More testing of CodeMirror autocomplete

This commit is contained in:
David Evans 2018-01-21 01:01:48 +00:00
parent 64e3f6aa03
commit ac7fd9ae7a
1 changed files with 17 additions and 0 deletions

View File

@ -386,6 +386,13 @@ defineDescribe('Code Mirror Mode', [
expect(hints).toContain('simultaneously ');
});
it('ignores indentation', () => {
cm.getDoc().setValue(' ');
const hints = getHintTexts({line: 0, ch: 2});
expect(hints).toContain('theme ');
expect(hints).toContain('title ');
});
it('suggests known header types', () => {
cm.getDoc().setValue('headers ');
const hints = getHintTexts({line: 0, ch: 8});
@ -493,6 +500,16 @@ defineDescribe('Code Mirror Mode', [
expect(hints).toContain('Foo Bar ');
});
it('suggests quoted agent names if a quote is typed', () => {
cm.getDoc().setValue('Zig Zag -> Meh\nFoo Bar -> "');
const hints = getHintTexts({line: 1, ch: 12});
expect(hints).toEqual([
'"Zig Zag" ',
'"Meh" ',
'"Foo Bar" ',
]);
});
it('suggests filtered multi-word agents', () => {
cm.getDoc().setValue('Zig Zag -> Meh\nFoo Bar -> Foo ');
const hints = getHintTexts({line: 1, ch: 15});