mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
fix: Info diagram case sensitivity
This commit is contained in:
@@ -35,11 +35,19 @@ describe('when parsing an info graph it', function () {
|
|||||||
}).toThrow();
|
}).toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO
|
it('should not throw an error when showInfo is not defined', function () {
|
||||||
// it('should no throw an error when showInfo is not defined', function () {
|
infoParser.parse('info');
|
||||||
// expect(() => {
|
expect(infoDb.getInfo()).toEqual(true);
|
||||||
// infoParser.parse('info');
|
});
|
||||||
// }).not.toThrow();
|
|
||||||
// expect(infoDb.getInfo()).toEqual(false);
|
it.each([
|
||||||
// });
|
`InFo`,
|
||||||
|
`Info
|
||||||
|
showinfo`,
|
||||||
|
`info
|
||||||
|
shOWINFO`,
|
||||||
|
])('should be case insensitive', function (str) {
|
||||||
|
infoParser.parse(str);
|
||||||
|
expect(infoDb.getInfo()).toEqual(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -2,8 +2,8 @@ import { createToken, EmbeddedActionsParser, Lexer } from 'chevrotain';
|
|||||||
import { log } from '../../logger';
|
import { log } from '../../logger';
|
||||||
import infoDb from './infoDb';
|
import infoDb from './infoDb';
|
||||||
|
|
||||||
const Info = createToken({ name: 'Info', pattern: /info/ });
|
const Info = createToken({ name: 'Info', pattern: /info/i });
|
||||||
const ShowInfo = createToken({ name: 'ShowInfo', pattern: /showInfo/ });
|
const ShowInfo = createToken({ name: 'ShowInfo', pattern: /showInfo/i });
|
||||||
const NewLine = createToken({
|
const NewLine = createToken({
|
||||||
name: 'NewLine',
|
name: 'NewLine',
|
||||||
pattern: /\r?\n/,
|
pattern: /\r?\n/,
|
||||||
@@ -44,7 +44,7 @@ class InfoParser extends EmbeddedActionsParser {
|
|||||||
|
|
||||||
public hdr = this.RULE('hdr', () => {
|
public hdr = this.RULE('hdr', () => {
|
||||||
this.CONSUME(Info);
|
this.CONSUME(Info);
|
||||||
this.CONSUME(NewLine);
|
this.OPTION(() => this.CONSUME(NewLine));
|
||||||
});
|
});
|
||||||
|
|
||||||
public row = this.RULE('row', () => {
|
public row = this.RULE('row', () => {
|
||||||
|
Reference in New Issue
Block a user