Skip to content

Commit

Permalink
test: [dot] add dotDiagram e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig committed Jul 31, 2022
1 parent 240e0af commit a743cd0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
41 changes: 41 additions & 0 deletions demo/cypress/e2e/dot/dot.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { stripStartEmptyLines } from '@pintora/test-shared'
import { makeSnapshotCases } from '../test-utils/render'

describe('DOT Diagram', () => {
makeSnapshotCases([
{
description: 'Should render arrow shapes',
code: stripStartEmptyLines(`
dotDiagram
digraph {
bgcolor="#faf5f5";
node [color="#111",bgcolor=orange]
s1 -> e1 [arrowhead="box"]
s2 -> e2 [arrowhead="obox"]
s3 -> e3 [arrowhead="dot"]
s4 -> e4 [arrowhead="odot"]
s5 -> e5 [arrowhead="open"]
s6 -> e6 [arrowhead="diamond"]
s7 -> e7 [arrowhead="ediamond"]
}
`),
},
{
description: 'Should render node shapes',
code: stripStartEmptyLines(`
dotDiagram
@param fontWeight bold
digraph {
bgcolor="#faf5f5";
node [color="#111",bgcolor=orange]
ellipse [shape="ellipse"];
circle [shape="circle"];
diamond [shape="diamond"];
plaintext [shape="plaintext"];
}
`),
},
])
})
2 changes: 1 addition & 1 deletion demo/cypress/e2e/er/er.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ erDiagram
.should('exist')
.then($ele => {
const ele = $ele[0]
const doc = (ele as unknown as SVGPathElement).ownerSVGElement
const doc = (ele as unknown as SVGPathElement).ownerSVGElement!
const entityA = doc.getElementById('entity-A')
const entityB = doc.getElementById('entity-B')
expect(entityA.getBoundingClientRect().y).to.greaterThan(entityB.getBoundingClientRect().y)
Expand Down
1 change: 0 additions & 1 deletion website/docs/diagrams/dot-diagram.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ dotDiagram
circle [shape="circle"];
diamond [shape="diamond"];
plaintext [shape="plaintext"];

}
```
Expand Down

0 comments on commit a743cd0

Please sign in to comment.