Skip to content

Commit

Permalink
JENKINS-70730 Don't remove id inside symbol (#7689)
Browse files Browse the repository at this point in the history
JENKINS-70730 Don't remove id in symbol
  • Loading branch information
timja committed Mar 28, 2023
1 parent 3a59e07 commit fdb63ea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion core/src/main/java/org/jenkins/ui/symbol/Symbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ private static String loadSymbol(String namespace, String name) {
.replaceAll("(class=\").*?(\")", "")
.replaceAll("(tooltip=\").*?(\")", "")
.replaceAll("(data-html-tooltip=\").*?(\")", "")
.replaceAll("(id=\").*?(\")", "")
.replace("stroke:#000", "stroke:currentColor");
}

Expand Down
12 changes: 12 additions & 0 deletions core/src/test/java/org/jenkins/ui/symbol/SymbolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.jvnet.hudson.test.Issue;

public class SymbolTest {
public static final String SCIENCE_PATH;
Expand Down Expand Up @@ -190,4 +191,15 @@ void getSymbol_notSettingTooltipDoesntAddTooltipAttribute_evenWithAmpersand() {
assertThat(symbol, containsString(SCIENCE_PATH));
assertThat(symbol, not(containsString("tooltip")));
}

@Test
@DisplayName("IDs in symbol should not be removed")
@Issue("JENKINS-70730")
void getSymbol_idInSymbolIsPresent() {
String symbol = Symbol.get(new SymbolRequest.Builder()
.withId("some-random-id")
.withName("with-id").build());

assertThat(symbol, containsString("id=\"a\""));
}
}
14 changes: 14 additions & 0 deletions core/src/test/resources/images/symbols/with-id.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fdb63ea

Please sign in to comment.