Skip to content

Commit

Permalink
test: add sequence artist test for boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig committed May 9, 2022
1 parent f22f85c commit 45311c6
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -687,3 +687,164 @@ Object {
},
}
`;

exports[`sequence-artist will render boxes 1`] = `
Object {
"mark": Object {
"attrs": Object {},
"children": Array [
Object {
"attrs": Object {},
"children": Array [
Object {
"attrs": Object {
"fill": "#d6d3fa",
"stroke": "#3b4044",
},
"type": "rect",
},
Object {
"attrs": Object {
"fill": "#3b4044",
"fontFamily": "Source Code Pro, sans-serif",
"fontSize": 16,
"fontWeight": "bold",
"text": "group participants",
"textAlign": "center",
"textBaseline": "top",
},
"type": "text",
},
],
"class": "sequence__participant-boxes",
"type": "group",
},
Object {
"children": Array [
Object {
"attrs": Object {
"stroke": "#3b4044",
},
"class": "actor__line",
"type": "line",
},
Object {
"attrs": Object {
"fill": "#fdb05e",
"radius": 4,
"stroke": "#3b4044",
},
"type": "rect",
},
Object {
"attrs": Object {
"fill": "#3b4044",
"fontFamily": "Source Code Pro, sans-serif",
"fontSize": 16,
"fontWeight": 400,
"text": "Alice",
"textAlign": "center",
"textBaseline": "middle",
},
"type": "text",
},
],
"class": "actor",
"type": "group",
},
Object {
"children": Array [
Object {
"attrs": Object {
"stroke": "#3b4044",
},
"class": "actor__line",
"type": "line",
},
Object {
"attrs": Object {
"fill": "#fdb05e",
"radius": 4,
"stroke": "#3b4044",
},
"type": "rect",
},
Object {
"attrs": Object {
"fill": "#3b4044",
"fontFamily": "Source Code Pro, sans-serif",
"fontSize": 16,
"fontWeight": 400,
"text": "B",
"textAlign": "center",
"textBaseline": "middle",
},
"type": "text",
},
],
"class": "actor",
"type": "group",
},
Object {
"attrs": Object {},
"children": Array [],
"class": "activations",
"type": "group",
},
Object {
"children": Array [
Object {
"attrs": Object {
"fill": "#fdb05e",
"radius": 4,
"stroke": "#3b4044",
},
"type": "rect",
},
Object {
"attrs": Object {
"fill": "#3b4044",
"fontFamily": "Source Code Pro, sans-serif",
"fontSize": 16,
"fontWeight": 400,
"text": "Alice",
"textAlign": "center",
"textBaseline": "middle",
},
"type": "text",
},
],
"class": "actor",
"type": "group",
},
Object {
"children": Array [
Object {
"attrs": Object {
"fill": "#fdb05e",
"radius": 4,
"stroke": "#3b4044",
},
"type": "rect",
},
Object {
"attrs": Object {
"fill": "#3b4044",
"fontFamily": "Source Code Pro, sans-serif",
"fontSize": 16,
"fontWeight": 400,
"text": "B",
"textAlign": "center",
"textBaseline": "middle",
},
"type": "text",
},
],
"class": "actor",
"type": "group",
},
],
"type": "group",
},
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,15 @@ describe('sequence-artist', () => {
const result = testDraw(code, { containerSize: { width: 300 } })
expect(Math.round(result.graphicIR.width)).toBe(300)
})

it('will render boxes', () => {
const code = `
sequenceDiagram
box #d6d3fa "group participants"
participant A as "Alice"
participant B
endbox
`
expect(stripDrawResultForSnapshot(testDraw(code))).toMatchSnapshot()
})
})

0 comments on commit 45311c6

Please sign in to comment.