mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
chore: added test for background rect dimensions
This commit is contained in:
parent
671a892b52
commit
8f6d148481
3
__mocks__/d3.js
vendored
3
__mocks__/d3.js
vendored
@ -4,6 +4,9 @@ let NewD3 = function () {
|
|||||||
append: function () {
|
append: function () {
|
||||||
return NewD3()
|
return NewD3()
|
||||||
},
|
},
|
||||||
|
lower: function () {
|
||||||
|
return this
|
||||||
|
},
|
||||||
attr: function () {
|
attr: function () {
|
||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
|
@ -980,6 +980,24 @@ describe('when rendering a sequenceDiagram', function () {
|
|||||||
expect(bounds.stopx).toBe(0 + conf.width * 2 + conf.actorMargin)
|
expect(bounds.stopx).toBe(0 + conf.width * 2 + conf.actorMargin)
|
||||||
expect(bounds.stopy).toBe(0 + 2 * conf.messageMargin + conf.height + 3 * conf.boxMargin + conf.boxTextMargin)
|
expect(bounds.stopy).toBe(0 + 2 * conf.messageMargin + conf.height + 3 * conf.boxMargin + conf.boxTextMargin)
|
||||||
})
|
})
|
||||||
|
it('it should draw background rect', function () {
|
||||||
|
renderer.bounds.init()
|
||||||
|
const str = `
|
||||||
|
sequenceDiagram
|
||||||
|
Alice->Bob: Hello Bob, are you alright?
|
||||||
|
rect rgb(0, 0, 0)
|
||||||
|
Bob->Alice: I feel surrounded by darkness
|
||||||
|
end
|
||||||
|
`
|
||||||
|
parser.parse(str)
|
||||||
|
renderer.draw(str, 'tst')
|
||||||
|
const bounds = renderer.bounds.getBounds()
|
||||||
|
expect(bounds.startx).toBe(0)
|
||||||
|
expect(bounds.starty).toBe(0)
|
||||||
|
|
||||||
|
expect(bounds.stopx).toBe(0 + conf.width * 2 + conf.actorMargin)
|
||||||
|
expect(bounds.stopy).toBe(0 + 2 * conf.messageMargin + conf.height + 3 * conf.boxMargin)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('when rendering a sequenceDiagram with actor mirror activated', function () {
|
describe('when rendering a sequenceDiagram with actor mirror activated', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user