-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snapshot test vor all new bpmn components
- Loading branch information
1 parent
7864c42
commit e7f187a
Showing
33 changed files
with
782 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../unit/packages/bpmn/bpmn-annotation/__snapshots__/bpmn-annotation-component-test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`render the bpmn-annotation-component 1`] = ` | ||
<body> | ||
<div> | ||
<svg> | ||
<g> | ||
<rect | ||
class="sc-fqkvVR joPxif" | ||
fill="transparent" | ||
height="100" | ||
rx="10" | ||
ry="10" | ||
stroke="transparent" | ||
width="200" | ||
/> | ||
<path | ||
class="sc-gEvEer JpXgg" | ||
d="M20,0 L10,0 A 10 10 280 0 0 0 10 L0,90 A 10 10 180 0 0 10 100 L20, 100" | ||
fill="transparent" | ||
stroke="black" | ||
/> | ||
<text | ||
font-weight="bold" | ||
height="100" | ||
pointer-events="none" | ||
text-anchor="middle" | ||
width="200" | ||
x="100" | ||
y="50" | ||
> | ||
<tspan | ||
dy="5.5" | ||
x="100" | ||
> | ||
Annotation | ||
</tspan> | ||
</text> | ||
</g> | ||
</svg> | ||
</div> | ||
</body> | ||
`; |
24 changes: 24 additions & 0 deletions
24
src/tests/unit/packages/bpmn/bpmn-annotation/bpmn-annotation-component-test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { wrappedRender } from '../../../test-utils/render'; | ||
import * as React from 'react'; | ||
import { SyntaxTreeTerminal } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal'; | ||
import { SyntaxTreeTerminalComponent } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal-component'; | ||
import { Multiline } from '../../../../../main/utils/svg/multiline'; | ||
import { CSSProperties } from 'react'; | ||
import { BPMNAnnotation } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation'; | ||
import { BPMNAnnotationComponent } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation-component'; | ||
|
||
// override getStringWidth, because it uses by jsdom unsupported SVGElement methods | ||
Multiline.prototype.getStringWidth = (str: string, style?: CSSProperties) => { | ||
return 0; | ||
}; | ||
|
||
it('render the bpmn-annotation-component', () => { | ||
const annotation: BPMNAnnotation = new BPMNAnnotation({ name: 'Annotation' }); | ||
const { getByText, baseElement } = wrappedRender( | ||
<svg> | ||
<BPMNAnnotationComponent element={annotation} /> | ||
</svg>, | ||
); | ||
expect(getByText(annotation.name)).toBeInTheDocument(); | ||
expect(baseElement).toMatchSnapshot(); | ||
}); |
38 changes: 38 additions & 0 deletions
38
...packages/bpmn/bpmn-call-activity/__snapshots__/bpmn-call-activity-component-test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`render the bpmn-call-activity-component 1`] = ` | ||
<body> | ||
<div> | ||
<svg> | ||
<g> | ||
<rect | ||
class="sc-fqkvVR kprGcp" | ||
fill="white" | ||
height="100" | ||
rx="10" | ||
ry="10" | ||
stroke="black" | ||
stroke-width="3" | ||
width="200" | ||
/> | ||
<text | ||
font-weight="bold" | ||
height="100" | ||
pointer-events="none" | ||
text-anchor="middle" | ||
width="200" | ||
x="100" | ||
y="50" | ||
> | ||
<tspan | ||
dy="5.5" | ||
x="100" | ||
> | ||
Call Activity | ||
</tspan> | ||
</text> | ||
</g> | ||
</svg> | ||
</div> | ||
</body> | ||
`; |
26 changes: 26 additions & 0 deletions
26
src/tests/unit/packages/bpmn/bpmn-call-activity/bpmn-call-activity-component-test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { wrappedRender } from '../../../test-utils/render'; | ||
import * as React from 'react'; | ||
import { SyntaxTreeTerminal } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal'; | ||
import { SyntaxTreeTerminalComponent } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal-component'; | ||
import { Multiline } from '../../../../../main/utils/svg/multiline'; | ||
import { CSSProperties } from 'react'; | ||
import { BPMNAnnotation } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation'; | ||
import { BPMNAnnotationComponent } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation-component'; | ||
import { BPMNCallActivity } from '../../../../../main/packages/bpmn/bpmn-call-activity/bpmn-call-activity'; | ||
import { BPMNCallActivityComponent } from '../../../../../main/packages/bpmn/bpmn-call-activity/bpmn-call-activity-component'; | ||
|
||
// override getStringWidth, because it uses by jsdom unsupported SVGElement methods | ||
Multiline.prototype.getStringWidth = (str: string, style?: CSSProperties) => { | ||
return 0; | ||
}; | ||
|
||
it('render the bpmn-call-activity-component', () => { | ||
const callActivity: BPMNCallActivity = new BPMNCallActivity({ name: 'Call Activity' }); | ||
const { getByText, baseElement } = wrappedRender( | ||
<svg> | ||
<BPMNCallActivityComponent element={callActivity} /> | ||
</svg>, | ||
); | ||
expect(getByText(callActivity.name)).toBeInTheDocument(); | ||
expect(baseElement).toMatchSnapshot(); | ||
}); |
34 changes: 34 additions & 0 deletions
34
...t/packages/bpmn/bpmn-conversation/__snapshots__/bpmn-conversation-component-test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`render the bpmn-conversation-component 1`] = ` | ||
<body> | ||
<div> | ||
<svg> | ||
<g> | ||
<polyline | ||
class="sc-aXZVg bUvEJV" | ||
fill="white" | ||
points="10 0, 30 0, 40 20, 30 40, 10 40, 0 20, 10 0" | ||
stroke="black" | ||
stroke-width="1" | ||
/> | ||
<text | ||
height="40" | ||
pointer-events="none" | ||
text-anchor="start" | ||
width="40" | ||
x="50" | ||
y="20" | ||
> | ||
<tspan | ||
dy="5.5" | ||
x="50" | ||
> | ||
Conversation | ||
</tspan> | ||
</text> | ||
</g> | ||
</svg> | ||
</div> | ||
</body> | ||
`; |
26 changes: 26 additions & 0 deletions
26
src/tests/unit/packages/bpmn/bpmn-conversation/bpmn-conversation-component-test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { wrappedRender } from '../../../test-utils/render'; | ||
import * as React from 'react'; | ||
import { SyntaxTreeTerminal } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal'; | ||
import { SyntaxTreeTerminalComponent } from '../../../../../main/packages/syntax-tree/syntax-tree-terminal/syntax-tree-terminal-component'; | ||
import { Multiline } from '../../../../../main/utils/svg/multiline'; | ||
import { CSSProperties } from 'react'; | ||
import { BPMNAnnotation } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation'; | ||
import { BPMNAnnotationComponent } from '../../../../../main/packages/bpmn/bpmn-annotation/bpmn-annotation-component'; | ||
import { BPMNConversationComponent } from '../../../../../main/packages/bpmn/bpmn-conversation/bpmn-conversation-component'; | ||
import { BPMNConversation } from '../../../../../main/packages/bpmn/bpmn-conversation/bpmn-conversation'; | ||
|
||
// override getStringWidth, because it uses by jsdom unsupported SVGElement methods | ||
Multiline.prototype.getStringWidth = (str: string, style?: CSSProperties) => { | ||
return 0; | ||
}; | ||
|
||
it('render the bpmn-conversation-component', () => { | ||
const conversation: BPMNConversation = new BPMNConversation({ name: 'Conversation' }); | ||
const { getByText, baseElement } = wrappedRender( | ||
<svg> | ||
<BPMNConversationComponent element={conversation} /> | ||
</svg>, | ||
); | ||
expect(getByText(conversation.name)).toBeInTheDocument(); | ||
expect(baseElement).toMatchSnapshot(); | ||
}); |
Oops, something went wrong.