mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 07:49:43 +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();
|
||||
});
|
||||
|
||||
// TODO
|
||||
// it('should no throw an error when showInfo is not defined', function () {
|
||||
// expect(() => {
|
||||
// infoParser.parse('info');
|
||||
// }).not.toThrow();
|
||||
// expect(infoDb.getInfo()).toEqual(false);
|
||||
// });
|
||||
it('should not throw an error when showInfo is not defined', function () {
|
||||
infoParser.parse('info');
|
||||
expect(infoDb.getInfo()).toEqual(true);
|
||||
});
|
||||
|
||||
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 infoDb from './infoDb';
|
||||
|
||||
const Info = createToken({ name: 'Info', pattern: /info/ });
|
||||
const ShowInfo = createToken({ name: 'ShowInfo', pattern: /showInfo/ });
|
||||
const Info = createToken({ name: 'Info', pattern: /info/i });
|
||||
const ShowInfo = createToken({ name: 'ShowInfo', pattern: /showInfo/i });
|
||||
const NewLine = createToken({
|
||||
name: 'NewLine',
|
||||
pattern: /\r?\n/,
|
||||
@@ -44,7 +44,7 @@ class InfoParser extends EmbeddedActionsParser {
|
||||
|
||||
public hdr = this.RULE('hdr', () => {
|
||||
this.CONSUME(Info);
|
||||
this.CONSUME(NewLine);
|
||||
this.OPTION(() => this.CONSUME(NewLine));
|
||||
});
|
||||
|
||||
public row = this.RULE('row', () => {
|
||||
|
Reference in New Issue
Block a user