This repository was archived by the owner on Mar 17, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Allow xlabel to be decribed with "Node" HTML like element #148
Merged
kamiazya
merged 1 commit into
ts-graphviz:master
from
tokidrill:feat/allow-xlabel-to-describe-with-htlm-like
Feb 10, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,75 @@ | ||
import React from 'react'; | ||
import 'jest-graphviz'; | ||
import { Digraph } from '../Digraph'; | ||
import { Node } from '../Node'; | ||
import { DOT } from '../HtmlLike'; | ||
import { renderToDot } from '../../renderer/render'; | ||
|
||
describe('Node', () => { | ||
test('pass without optional props and render correctly', () => { | ||
const dot = renderToDot( | ||
<Digraph> | ||
<Node id="aaa" /> | ||
</Digraph>, | ||
); | ||
expect(dot).toBeValidDotAndMatchSnapshot(); | ||
}); | ||
|
||
test('pass label with string and render correctly', () => { | ||
const dot = renderToDot( | ||
<Digraph> | ||
<Node id="aaa" label="label test" /> | ||
kamiazya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Digraph>, | ||
); | ||
expect(dot).toBeValidDotAndMatchSnapshot(); | ||
}); | ||
|
||
test('pass label with HTMLLike ReactElement and render correctly', () => { | ||
const dot = renderToDot( | ||
<Digraph> | ||
<Node | ||
id="aaa" | ||
kamiazya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
label={ | ||
<DOT.TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> | ||
<DOT.TR> | ||
<DOT.TD>left</DOT.TD> | ||
<DOT.TD PORT="m">middle</DOT.TD> | ||
<DOT.TD PORT="r">right</DOT.TD> | ||
</DOT.TR> | ||
</DOT.TABLE> | ||
} | ||
/> | ||
</Digraph>, | ||
); | ||
expect(dot).toBeValidDotAndMatchSnapshot(); | ||
}); | ||
|
||
test('pass xlabel with string and render correctly', () => { | ||
const dot = renderToDot( | ||
<Digraph> | ||
<Node id="aaa" xlabel="xlabel test" /> | ||
kamiazya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Digraph>, | ||
); | ||
expect(dot).toBeValidDotAndMatchSnapshot(); | ||
}); | ||
|
||
test('pass xlabel with HTMLLike ReactElement and render correctly', () => { | ||
const dot = renderToDot( | ||
<Digraph> | ||
<Node | ||
id="aaa" | ||
xlabel={ | ||
<DOT.TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> | ||
<DOT.TR> | ||
<DOT.TD>left</DOT.TD> | ||
<DOT.TD PORT="m">middle</DOT.TD> | ||
<DOT.TD PORT="r">right</DOT.TD> | ||
</DOT.TR> | ||
</DOT.TABLE> | ||
} | ||
/> | ||
</Digraph>, | ||
); | ||
expect(dot).toBeValidDotAndMatchSnapshot(); | ||
}); | ||
}); |
This file contains hidden or 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,39 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Node pass label with HTMLLike ReactElement and render correctly 1`] = ` | ||
digraph { | ||
"aaa" [ | ||
label = <<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD>left</TD><TD PORT="m">middle</TD><TD PORT="r">right</TD></TR></TABLE>>, | ||
]; | ||
} | ||
`; | ||
|
||
exports[`Node pass label with string and render correctly 1`] = ` | ||
digraph { | ||
"aaa" [ | ||
label = "label test", | ||
]; | ||
} | ||
`; | ||
|
||
exports[`Node pass without optional props and render correctly 1`] = ` | ||
digraph { | ||
"aaa"; | ||
} | ||
`; | ||
|
||
exports[`Node pass xlabel with HTMLLike ReactElement and render correctly 1`] = ` | ||
digraph { | ||
"aaa" [ | ||
xlabel = <<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD>left</TD><TD PORT="m">middle</TD><TD PORT="r">right</TD></TR></TABLE>>, | ||
]; | ||
} | ||
`; | ||
|
||
exports[`Node pass xlabel with string and render correctly 1`] = ` | ||
digraph { | ||
"aaa" [ | ||
xlabel = "xlabel test", | ||
]; | ||
} | ||
`; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.