Skip to content

Commit 15da002

Browse files
authored
Fix skipped tests icon and link (#743)
1 parent 066f524 commit 15da002

File tree

5 files changed

+59
-19
lines changed

5 files changed

+59
-19
lines changed

src/main/java/hudson/tasks/junit/CaseResult.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.jvnet.localizer.Localizable;
5050
import org.kohsuke.accmod.Restricted;
5151
import org.kohsuke.accmod.restrictions.Beta;
52+
import org.kohsuke.accmod.restrictions.NoExternalUse;
5253
import org.kohsuke.stapler.Stapler;
5354
import org.kohsuke.stapler.export.Exported;
5455

@@ -1094,4 +1095,13 @@ public boolean isRegression() {
10941095
/*package*/ static final Comparator<CaseResult> BY_AGE = Comparator.comparingInt(CaseResult::getAge);
10951096

10961097
private static final long serialVersionUID = 1L;
1098+
1099+
@Restricted(NoExternalUse.class)
1100+
public String getIconFileName() {
1101+
return switch (getStatus()) {
1102+
case PASSED -> "symbol-checkmark-outline plugin-ionicons-api";
1103+
case SKIPPED -> "symbol-play-skip-forward-outline plugin-ionicons-api";
1104+
default -> "symbol-close-outline plugin-ionicons-api";
1105+
};
1106+
}
10971107
}

src/main/resources/hudson/tasks/junit/CaseResult/index.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ THE SOFTWARE.
5252
</div>
5353
<div class="jp-details">
5454
<div class="${it.status.cssClass}">
55-
<l:icon src="${it.status == 'PASSED' ? 'symbol-checkmark-outline plugin-ionicons-api' : 'symbol-close-outline plugin-ionicons-api'}" />
55+
<l:icon src="${it.iconFileName}" />
5656
${it.status.message}
5757
</div>
5858

Lines changed: 8 additions & 0 deletions
Loading

src/main/resources/lib/hudson/test/table.jelly

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,40 @@ THE SOFTWARE.
6262
<j:set var="url" value="${attrs.baseUrl}${f.getRelativePathFrom(attrs.relativeParent ?: it)}" />
6363
<j:set var="id" value="${h.htmlAttributeEscape(url)}" />
6464

65-
<a id="test-${id}-showlink" class="jp-table-row" href="${url}">
66-
<l:icon src="${f.status == 'PASSED' ? 'symbol-status-blue' : 'symbol-status-red'}" />
65+
<j:choose>
66+
<j:when test="${f.status == 'SKIPPED'}">
67+
<div class="jp-table-row">
68+
<l:icon src="symbol-status-skipped plugin-junit" />
69+
70+
${f.name}
6771

68-
${f.name}
72+
<j:if test="${it.class.simpleName eq 'TestResult'}">
73+
<span class="jenkins-!-text-color-secondary jenkins-!-margin-left-2" style="font-family: var(--font-family-mono)">
74+
<st:out value="${f.className}" />
75+
</span>
76+
</j:if>
77+
78+
<t:condition-tag test="${f}" clazz="jenkins-!-margin-left-2 jenkins-mobile-hide" />
79+
</div>
80+
</j:when>
81+
<j:otherwise>
82+
<a id="test-${id}-showlink" class="jp-table-row" href="${url}">
83+
<l:icon src="${f.status == 'PASSED' ? 'symbol-status-blue' : 'symbol-status-red'}" />
6984

70-
<j:if test="${it.class.simpleName eq 'TestResult'}">
71-
<span class="jenkins-!-text-color-secondary jenkins-!-margin-left-2" style="font-family: var(--font-family-mono)">
72-
<st:out value="${f.className}" />
73-
</span>
74-
</j:if>
85+
${f.name}
7586

76-
<t:condition-tag test="${f}" clazz="jenkins-!-margin-left-2 jenkins-mobile-hide" />
87+
<j:if test="${it.class.simpleName eq 'TestResult'}">
88+
<span class="jenkins-!-text-color-secondary jenkins-!-margin-left-2" style="font-family: var(--font-family-mono)">
89+
<st:out value="${f.className}" />
90+
</span>
91+
</j:if>
7792

78-
<l:icon src="symbol-chevron-forward-outline plugin-ionicons-api" class="jenkins-!-margin-left-2" />
79-
</a>
93+
<t:condition-tag test="${f}" clazz="jenkins-!-margin-left-2 jenkins-mobile-hide" />
94+
95+
<l:icon src="symbol-chevron-forward-outline plugin-ionicons-api" class="jenkins-!-margin-left-2" />
96+
</a>
97+
</j:otherwise>
98+
</j:choose>
8099

81100
<j:forEach var="badge" items="${f.testActions}">
82101
<st:include it="${badge}" page="badge.jelly" optional="true" />

src/main/webapp/styles.css

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ a.jp-pill, button.jp-pill {
108108
}
109109

110110
/* Custom table row */
111+
a.jp-table-row {
112+
cursor: pointer;
113+
}
114+
111115
.jp-table-row {
112116
display: flex;
113117
align-items: center;
@@ -130,23 +134,22 @@ a.jp-pill, button.jp-pill {
130134
background: none;
131135
outline: none;
132136
border: none;
133-
cursor: pointer;
134137
border-radius: inherit;
135138
transition: background var(--standard-transition);
136139

137-
svg:first-of-type {
138-
width: 1.25rem;
139-
height: 1.25rem;
140-
margin-right: 1rem;
141-
}
142-
143140
svg:last-of-type {
144141
width: 1rem;
145142
height: 1rem;
146143
color: var(--text-color-secondary);
147144
transition: rotate var(--standard-transition);
148145
}
149146

147+
svg:first-of-type {
148+
width: 1.25rem;
149+
height: 1.25rem;
150+
margin-right: 1rem;
151+
}
152+
150153
@media (width <= 800px) {
151154
display: grid;
152155
grid-template-columns: auto 1fr;

0 commit comments

Comments
 (0)