This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
html_completer_test.js
57 lines (49 loc) · 1.97 KB
/
html_completer_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"use strict";
"use server";
require("c9/inline-mocha")(module);
require("../../test/setup_paths");
if (typeof process !== "undefined") {
require("amd-loader");
}
var assert = require("ace/test/assertions");
var Document = require("ace/document").Document;
var completer = require("plugins/c9.ide.language.html/html_completer");
describe(__filename, function() {
it("basic snippet completion 1", function(next) {
var doc = new Document("<bo");
completer.complete(doc, null, { row: 0, column: 3 }, null, function(matches) {
console.log("Matches:", matches);
assert.equal(matches.length, 1);
assert.equal(matches[0].name, "body");
next();
});
});
it("basic snippet completion 2", function(next) {
var doc = new Document("link");
completer.complete(doc, null, { row: 0, column: 3 }, null, function(matches) {
console.log("Matches:", matches);
assert.equal(matches.length, 1);
assert.ok(matches[0].replaceText.match(/^<link .*stylesheet.*css.*\/>$/));
next();
});
});
it("Jade/Haml completion 1", function(next) {
var doc = new Document("\n.breaty");
completer.complete(doc, null, { row: 1, column: 7 }, null, function(matches) {
console.log("Matches:", matches);
assert.equal(matches.length, 1);
assert.equal(matches[0].replaceText, '<div class="breaty">^^</div>');
next();
});
});
it("Jade/Haml completion 2", function(next) {
var doc = new Document("<span>anything</span>table.cool<p>stuff</p>");
completer.complete(doc, null, { row: 0, column: 31 }, null, function(matches) {
console.log("Matches:", matches);
assert.equal(matches.length, 1);
assert.ok(matches[0].replaceText.match(/^<table/));
assert.ok(matches[0].replaceText.match(/<\/table>$/));
next();
});
});
});