Skip to content

Commit e80acf8

Browse files
committed
Move the "don't escape text in labels" test to only test SVG
Since a0f2eef, label text is passed to <AppNodeText> as HTML, rather than text. This reintroduces the HTML injection that was eliminated in #908. Setting v-html was done to support rendering highlighted text, but it also makes it so that any HTML in labels is also passed straight through as HTML. It also probably introduces some bugs in rendering genotypes that have "<...>" strings in them. I'm doing this now because we really need to get the SVG rendering fixed.
1 parent dcf216e commit e80acf8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

frontend/src/components/AppNodeText.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ onUpdated(() => {
126126
.highlight-text em {
127127
background-color: yellow;
128128
}
129-
</style>
129+
</style>

frontend/unit/AppNodeText.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ test("Renders superscripted as a span in SVG", async () => {
5252
expect(htmlEl.get("span span").text()).toEqual("name");
5353
});
5454

55+
// FIXME: This fails on non-SVG text because the HTML <span> element in
56+
// AppNodeText.vue takes `v-html` rather than `v-text`. This was done to
57+
// support highlighting in a0f2eefb75b79def58940a652f4fdf7a23c8c931.
5558
test("Escapes non-whitelisted 'tags'", async () => {
56-
const props = { text: "Node <test>name</test>" };
59+
const props = { text: "Node <test>name</test>", isSvg: true };
5760

5861
const htmlEl = mount(AppNodeText, { props });
5962
expect(htmlEl.get("span").text()).toEqual("Node <test>name</test>");

0 commit comments

Comments
 (0)