mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Added new Jest test case for usecase A[text].class
This commit is contained in:
parent
2e0843c226
commit
afa95172b6
@ -1696,6 +1696,22 @@ describe('when parsing ', function () {
|
||||
const vertices = flow.parser.yy.getVertices()
|
||||
const classes = flow.parser.yy.getClasses()
|
||||
|
||||
it('should be possible to apply a class to a vertex directly : usecase A[text].class ', function () {
|
||||
let statement = ''
|
||||
|
||||
statement = statement + 'graph TD;' + '\n'
|
||||
statement = statement + 'classDef exClass background:#bbb,border:1px solid red;' + '\n'
|
||||
statement = statement + 'b[test].exClass;' + '\n'
|
||||
|
||||
const res = flow.parser.parse(statement)
|
||||
const vertices = flow.parser.yy.getVertices()
|
||||
const classes = flow.parser.yy.getClasses()
|
||||
|
||||
expect(classes['exClass'].styles.length).toBe(2)
|
||||
expect(vertices['b'].classes[0]).toBe('exClass')
|
||||
expect(classes['exClass'].styles[0]).toBe('background:#bbb')
|
||||
expect(classes['exClass'].styles[1]).toBe('border:1px solid red')
|
||||
})
|
||||
expect(classes['exClass'].styles.length).toBe(2)
|
||||
expect(vertices['b'].classes[0]).toBe('exClass')
|
||||
expect(classes['exClass'].styles[0]).toBe('background:#bbb')
|
||||
|
Loading…
x
Reference in New Issue
Block a user