@terra-graph/core 1.0.0-rc.5 → 1.0.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -162,7 +162,10 @@ ${legendRows}
|
|
|
162
162
|
if (firstBrace === -1) {
|
|
163
163
|
return output;
|
|
164
164
|
}
|
|
165
|
-
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}
|
|
165
|
+
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`
|
|
166
|
+
.replace(/"\s*<</g, '<<')
|
|
167
|
+
.replace(/>>\s*"/g, '>>')
|
|
168
|
+
.replaceAll('\\"', '"');
|
|
166
169
|
}
|
|
167
170
|
buildNodeLabel(node) {
|
|
168
171
|
return new TgNodeLabel_js_1.TgNodeLabel(node).getLabel();
|
|
@@ -966,6 +966,24 @@ describe('DotRenderer.applyLegend', () => {
|
|
|
966
966
|
expect(next).toContain('cluster_Legend');
|
|
967
967
|
expect(next).toContain('Owner:');
|
|
968
968
|
});
|
|
969
|
+
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
970
|
+
const renderer = new DotRenderer_js_1.DotRenderer();
|
|
971
|
+
const subject = renderer;
|
|
972
|
+
const tg = {
|
|
973
|
+
schemaVersion: TgGraph_js_1.TG_SCHEMA_VERSION,
|
|
974
|
+
description: {
|
|
975
|
+
Environment: 'test',
|
|
976
|
+
},
|
|
977
|
+
nodes: {},
|
|
978
|
+
edges: [],
|
|
979
|
+
};
|
|
980
|
+
const output = `digraph { "node-html" [label="
|
|
981
|
+
<<table><tr><td>\\\"hello\\\"</td></tr></table>>
|
|
982
|
+
"]; }`;
|
|
983
|
+
const next = subject.applyLegend(output, tg);
|
|
984
|
+
expect(next).toContain('label=<<table><tr><td>"hello"</td></tr></table>>');
|
|
985
|
+
expect(next).not.toContain('label="\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "');
|
|
986
|
+
});
|
|
969
987
|
});
|
|
970
988
|
describe('DotRenderer.applyRanks', () => {
|
|
971
989
|
it('shoud return output unchanged when closing brace is missing', () => {
|
|
@@ -156,7 +156,10 @@ ${legendRows}
|
|
|
156
156
|
if (firstBrace === -1) {
|
|
157
157
|
return output;
|
|
158
158
|
}
|
|
159
|
-
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}
|
|
159
|
+
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`
|
|
160
|
+
.replace(/"\s*<</g, '<<')
|
|
161
|
+
.replace(/>>\s*"/g, '>>')
|
|
162
|
+
.replaceAll('\\"', '"');
|
|
160
163
|
}
|
|
161
164
|
buildNodeLabel(node) {
|
|
162
165
|
return new TgNodeLabel(node).getLabel();
|
|
@@ -964,6 +964,24 @@ describe('DotRenderer.applyLegend', () => {
|
|
|
964
964
|
expect(next).toContain('cluster_Legend');
|
|
965
965
|
expect(next).toContain('Owner:');
|
|
966
966
|
});
|
|
967
|
+
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
968
|
+
const renderer = new DotRenderer();
|
|
969
|
+
const subject = renderer;
|
|
970
|
+
const tg = {
|
|
971
|
+
schemaVersion: TG_SCHEMA_VERSION,
|
|
972
|
+
description: {
|
|
973
|
+
Environment: 'test',
|
|
974
|
+
},
|
|
975
|
+
nodes: {},
|
|
976
|
+
edges: [],
|
|
977
|
+
};
|
|
978
|
+
const output = `digraph { "node-html" [label="
|
|
979
|
+
<<table><tr><td>\\\"hello\\\"</td></tr></table>>
|
|
980
|
+
"]; }`;
|
|
981
|
+
const next = subject.applyLegend(output, tg);
|
|
982
|
+
expect(next).toContain('label=<<table><tr><td>"hello"</td></tr></table>>');
|
|
983
|
+
expect(next).not.toContain('label="\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "');
|
|
984
|
+
});
|
|
967
985
|
});
|
|
968
986
|
describe('DotRenderer.applyRanks', () => {
|
|
969
987
|
it('shoud return output unchanged when closing brace is missing', () => {
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terra-graph/core",
|
|
3
|
+
"license": "Apache-2.0",
|
|
3
4
|
"author": {
|
|
4
5
|
"name": "Kevin Baldwyn",
|
|
5
6
|
"url": "https://github.com/terra-graph/core"
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git+https://github.com/terra-graph/core.git"
|
|
10
11
|
},
|
|
11
|
-
"version": "1.0.0-rc.
|
|
12
|
+
"version": "1.0.0-rc.7",
|
|
12
13
|
"main": "./dist/cjs/index.js",
|
|
13
14
|
"module": "./dist/esm/index.js",
|
|
14
15
|
"types": "./dist/esm/index.d.ts",
|