diff --git a/core/src/test/java/org/jenkins/ui/icon/IconSetJenkins68805Test.java b/core/src/test/java/org/jenkins/ui/icon/IconSetJenkins68805Test.java new file mode 100644 index 0000000000..ec88b6e86c --- /dev/null +++ b/core/src/test/java/org/jenkins/ui/icon/IconSetJenkins68805Test.java @@ -0,0 +1,33 @@ +package org.jenkins.ui.icon; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.not; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.jvnet.hudson.test.Issue; + +public class IconSetJenkins68805Test { + + /** + * Culprit: https://github.com/jenkinsci/jenkins/blob/ab0bb8495819bd807a9211ac0df3f08e420226f1/core/src/main/java/org/jenkins/ui/icon/IconSet.java#L97= + * If the tooltip contains an ampersand symbol (&), it won't be removed. + * + *
This test relies on the behavior of the symbol cache, so must be in its own class.
+ */ + @Test + @Issue("JENKINS-68805") + @Disabled("Issue is not fixed") + void getSymbol_notSettingTooltipDoesntAddTooltipAttribute_evenWithAmpersand() { + // cache a symbol with tooltip containing ampersand: + String symbolWithTooltip = IconSet.getSymbol("download", "Title", "With&Ampersand", "class1 class2", "", "id"); + assertThat(symbolWithTooltip, containsString("tooltip")); + assertThat(symbolWithTooltip, containsString("With&")); + + // Same symbol, no tooltip + String symbolWithoutTooltip = IconSet.getSymbol("download", "Title", "", "class1 class2", "", "id"); + + assertThat(symbolWithoutTooltip, not(containsString("tooltip"))); + } +} diff --git a/core/src/test/java/org/jenkins/ui/icon/IconSetTest.java b/core/src/test/java/org/jenkins/ui/icon/IconSetTest.java index 3a48f66ac9..f8d75c03cb 100644 --- a/core/src/test/java/org/jenkins/ui/icon/IconSetTest.java +++ b/core/src/test/java/org/jenkins/ui/icon/IconSetTest.java @@ -6,7 +6,6 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.not; import java.util.Map; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public class IconSetTest { @@ -68,15 +67,4 @@ public class IconSetTest { assertThat(symbol, not(containsString("tooltip"))); } - /** - * Culprit: https://github.com/jenkinsci/jenkins/blob/ab0bb8495819bd807a9211ac0df3f08e420226f1/core/src/main/java/org/jenkins/ui/icon/IconSet.java#L97= - * If the tooltip contains an ampersand symbol (&), it won't be removed. - */ - @Disabled("TODO see JENKINS-68805") - @Test - void getSymbol_notSettingTooltipDoesntAddTooltipAttribute_evenWithAmpersand() { - String symbol = IconSet.getSymbol("download", "Title", "With&Ampersand", "class1 class2", "", "id"); - - assertThat(symbol, not(containsString("tooltip"))); - } }