mirror of https://github.com/mthenw/frontail.git
parent
26c3957457
commit
57367a2b0d
|
@ -121,13 +121,16 @@ describe('browser application', () => {
|
|||
it('should highlight word', () => {
|
||||
io.emit('options:highlightConfig', {
|
||||
words: {
|
||||
line: 'background: black'
|
||||
foo: 'background: black',
|
||||
bar: 'background: black'
|
||||
}
|
||||
});
|
||||
io.emit('line', 'line1');
|
||||
io.emit('line', 'foo bar');
|
||||
|
||||
const line = window.document.querySelector('.line');
|
||||
line.innerHTML.should.containEql('<span style="background: black">line</span>');
|
||||
line.innerHTML.should.containEql(
|
||||
'<span style="background: black">foo</span> <span style="background: black">bar</span>'
|
||||
);
|
||||
});
|
||||
|
||||
it('should highlight line', () => {
|
||||
|
|
|
@ -177,7 +177,7 @@ window.App = (function app(window, document) {
|
|||
|
||||
if (_highlightConfig && _highlightConfig.words) {
|
||||
Object.keys(_highlightConfig.words).forEach((wordCheck) => {
|
||||
output = line.replace(
|
||||
output = output.replace(
|
||||
wordCheck,
|
||||
'<span style="' + _highlightConfig.words[wordCheck] + '">' + wordCheck + '</span>'
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue