forked from highlightjs/highlight.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noHighlight.js
59 lines (44 loc) · 1.6 KB
/
noHighlight.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
58
59
'use strict';
describe('no highlighting', () => {
before(() => {
const testHTML = document.querySelectorAll('#no-highlight pre');
this.blocks = [...testHTML].map((x) => x.children[0].innerHTML);
this.expected = {
html: '<div id="contents">\n ' +
'<p>Hello, World!\n</div>',
python: 'for x in [1, 2, 3]: count(x)',
javascript: '<span class="hljs-keyword">var</span> x = ' +
'<span class="hljs-string">\'foo\'</span>;'
};
});
it('should keep block unchanged (nohighlight)', () => {
const expected = this.expected.html,
actual = this.blocks[0];
actual.should.equal(expected);
});
it('should keep block unchanged (no-highlight)', () => {
const expected = this.expected.html,
actual = this.blocks[1];
actual.should.equal(expected);
});
it('should skip pre tags without a child code tag', () => {
const expected = 'Computer output',
actual = this.blocks[2];
actual.should.equal(expected);
});
it('should keep block unchanged (unsupported language)', () => {
const expected = this.expected.python,
actual = this.blocks[3];
actual.should.equal(expected);
});
it('should keep block unchanged (unsupported lang)', () => {
const expected = this.expected.python,
actual = this.blocks[4];
actual.should.equal(expected);
});
it('should keep block unchanged (unsupported prefixed language)', () => {
const expected = this.expected.python,
actual = this.blocks[5];
actual.should.equal(expected);
});
});