forked from highlightjs/highlight.js
/
fixmarkup.js
31 lines (24 loc) · 969 Bytes
/
fixmarkup.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
'use strict';
const should = require('should');
const hljs = require('../../build');
describe('.fixmarkup()', () => {
after(() => {
hljs.configure({ useBR: false });
});
it('should not strip HTML from beginning of strings', () => {
hljs.configure({ useBR: true });
const value = '<span class="hljs-attr">"some"</span>: \n <span class="hljs-string">"json"</span>';
const result = hljs.fixMarkup(value);
result.should.equal(
'<span class="hljs-attr">"some"</span>: <br> <span class="hljs-string">"json"</span>'
);
});
it('should not add "undefined" to the beginning of the result (#1452)', () => {
hljs.configure({ useBR: true });
const value = '{ <span class="hljs-attr">"some"</span>: \n <span class="hljs-string">"json"</span> }';
const result = hljs.fixMarkup(value);
result.should.equal(
'{ <span class="hljs-attr">"some"</span>: <br> <span class="hljs-string">"json"</span> }'
);
});
});