create acceptance tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
8ac2c7219f
commit
8018a20680
|
@ -281,5 +281,38 @@ describe('editor/model', function() {
|
||||||
expect(model.parts[0].type).toBe("plain");
|
expect(model.parts[0].type).toBe("plain");
|
||||||
expect(model.parts[0].text).toBe("try #define");
|
expect(model.parts[0].text).toBe("try #define");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('insert room pill without splitting at the semi-colon', () => {
|
||||||
|
const renderer = createRenderer();
|
||||||
|
const pc = createPartCreator([{resourceId: "#room:server"}]);
|
||||||
|
const model = new EditorModel([], pc, renderer);
|
||||||
|
|
||||||
|
model.update("#roo", "insertText", {offset: 4, atNodeEnd: true});
|
||||||
|
|
||||||
|
expect(renderer.count).toBe(1);
|
||||||
|
expect(model.parts.length).toBe(1);
|
||||||
|
expect(model.parts[0].type).toBe("pill-candidate");
|
||||||
|
expect(model.parts[0].text).toBe("#roo");
|
||||||
|
|
||||||
|
model.update("#room:s", "insertText", {offset: 7, atNodeEnd: true});
|
||||||
|
|
||||||
|
expect(renderer.count).toBe(2);
|
||||||
|
expect(model.parts.length).toBe(1);
|
||||||
|
expect(model.parts[0].type).toBe("pill-candidate");
|
||||||
|
expect(model.parts[0].text).toBe("#room:s");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('allow typing e-mail addresses without splitting at the @', () => {
|
||||||
|
const renderer = createRenderer();
|
||||||
|
const pc = createPartCreator([{resourceId: "@alice", label: "Alice"}]);
|
||||||
|
const model = new EditorModel([], pc, renderer);
|
||||||
|
|
||||||
|
model.update("foo@a", "insertText", {offset: 5, atNodeEnd: true});
|
||||||
|
|
||||||
|
expect(renderer.count).toBe(1);
|
||||||
|
expect(model.parts.length).toBe(1);
|
||||||
|
expect(model.parts[0].type).toBe("plain");
|
||||||
|
expect(model.parts[0].text).toBe("foo@a");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue