mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 23:39:50 +02:00
Added Jest test case for 'should be possible to apply a class to a vertex directly' use-case
This commit is contained in:
@@ -1685,6 +1685,22 @@ describe('when parsing ', function () {
|
||||
expect(classes['exClass'].styles[0]).toBe('background:#bbb')
|
||||
expect(classes['exClass'].styles[1]).toBe('border:1px solid red')
|
||||
})
|
||||
it('should be possible to apply a class to a vertex directly', function () {
|
||||
let statement = ''
|
||||
|
||||
statement = statement + 'graph TD;' + '\n'
|
||||
statement = statement + 'classDef exClass background:#bbb,border:1px solid red;' + '\n'
|
||||
statement = statement + 'a-->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')
|
||||
})
|
||||
it('should be possible to apply a class to a comma separated list of vertices', function () {
|
||||
let statement = ''
|
||||
|
||||
|
Reference in New Issue
Block a user