Skip to content
Snippets Groups Projects
Commit e915b46c authored by syuilo's avatar syuilo
Browse files

(maybe) Fix bug

parent 75a7ad9d
No related branches found
No related tags found
No related merge requests found
......@@ -189,6 +189,7 @@ const elements = [
}
if (thisIsNotARegexp) return null;
if (regexp == '') return null;
if (regexp[0] == ' ' && regexp[regexp.length - 1] == ' ') return null;
return {
......
......@@ -5,7 +5,7 @@
const assert = require('assert');
const analyze = require('../src/common/text');
//const compile = require('../src/web/app/common/scripts/text-compiler');
const syntaxhighlighter = require('../src/common/text/core/syntax-highlighter');
describe('Text', () => {
it('is correctly analyzed', () => {
......@@ -59,4 +59,16 @@ describe('Text', () => {
assert.equal(tokens[0].type, 'inline-code');
assert.equal(tokens[0].content, '`var x = "Strawberry Pasta";`');
});
describe('syntax highlighting', () => {
it('regexp', () => {
const html = syntaxhighlighter('/.*/');
assert.equal(html, '<span class="regexp">/.*/</span>');
});
it('slash', () => {
const html = syntaxhighlighter('/');
assert.equal(html, '<span class="symbol">/</span>');
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment