Added new Jest test case for usecase A[text].class

This commit is contained in:
ashishjain0512 2019-07-23 06:45:35 -07:00
parent 2e0843c226
commit afa95172b6

View File

@ -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')