-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow links and formatting in causeString
- Loading branch information
Showing
5 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/main/resources/org/jenkinsci/plugins/gwt/GenericCause/description.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<span><j:out value="${it.getShortDescription()}"/></span> | ||
</j:jelly> |
37 changes: 37 additions & 0 deletions
37
src/test/java/org/jenkinsci/plugins/gwt/GenericCauseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.jenkinsci.plugins.gwt; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import hudson.model.Cause; | ||
import org.junit.Test; | ||
|
||
public class GenericCauseTest { | ||
|
||
@Test | ||
public void sanitizeCauseStringTest() { | ||
|
||
Cause cause = | ||
new GenericCause( | ||
null, | ||
null, | ||
false, | ||
false, | ||
"<b>Triggered by:</b> <a href=\"https://test.org/pr/1\">PR 1</a>"); | ||
|
||
String expected = | ||
"<b>Triggered by:</b> <a href=\"https://test.org/pr/1\" rel=\"nofollow\">PR 1</a>"; | ||
|
||
assertThat(expected).isEqualTo(cause.getShortDescription()); | ||
|
||
cause = | ||
new GenericCause( | ||
null, | ||
null, | ||
false, | ||
false, | ||
"<b>Triggered by:</b> PR 1<div><script>somethingBad()</script></div>"); | ||
expected = "<b>Triggered by:</b> PR 1"; | ||
|
||
assertThat(expected).isEqualTo(cause.getShortDescription()); | ||
} | ||
} |