[JENKINS-68805] Fix test to actually demonstrate the problem (#6988)

This commit is contained in:
Daniel Beck authored and GitHub committed 2022-08-30 15:34:43 -07:00
1 parent 5e11230982
commit 01e637ec08
2 files changed
+33 -12

No files matched your search

@@ -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.
*
* <p>This test relies on the behavior of the symbol cache, so must be in its own class.</p>
*/
@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")));
}
}
@@ -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 (&amp;), 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")));
}
}