Skip to content

Commit

Permalink
[JENKINS-14749] Errors in styles.css (#8148)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jun 27, 2023
1 parent 82d561f commit 0ae6ad5
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 5 deletions.
83 changes: 83 additions & 0 deletions test/src/test/java/jenkins/bugs/Jenkins14749Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package jenkins.bugs;

import hudson.model.FreeStyleProject;
import org.htmlunit.cssparser.parser.CSSErrorHandler;
import org.htmlunit.cssparser.parser.CSSException;
import org.htmlunit.cssparser.parser.CSSParseException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.jvnet.hudson.test.JenkinsRule;

public class Jenkins14749Test {

@Rule
public JenkinsRule j = new JenkinsRule();

@Rule
public ErrorCollector errors = new ErrorCollector();

@Test
public void dashboard() throws Exception {
JenkinsRule.WebClient webClient = createErrorReportingWebClient();
webClient.goTo("");
}

@Test
public void project() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
JenkinsRule.WebClient webClient = createErrorReportingWebClient();
webClient.getPage(p);
}

@Test
public void configureProject() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
JenkinsRule.WebClient webClient = createErrorReportingWebClient();
webClient.getPage(p, "configure");
}

@Test
public void manage() throws Exception {
JenkinsRule.WebClient webClient = createErrorReportingWebClient();
webClient.goTo("manage");
}

@Test
public void system() throws Exception {
JenkinsRule.WebClient webClient = createErrorReportingWebClient();
webClient.goTo("manage/configure");
}

private JenkinsRule.WebClient createErrorReportingWebClient() {
JenkinsRule.WebClient webClient = j.createWebClient();
webClient.setCssErrorHandler(new CSSErrorHandler() {
@Override
public void warning(final CSSParseException exception) throws CSSException {
if (!ignore(exception)) {
errors.addError(exception);
}
}

@Override
public void error(final CSSParseException exception) throws CSSException {
if (!ignore(exception)) {
errors.addError(exception);
}
}

@Override
public void fatalError(final CSSParseException exception) throws CSSException {
if (!ignore(exception)) {
errors.addError(exception);
}
}

private boolean ignore(final CSSParseException exception) {
// Keep in sync with HudsonTestCase/JenkinsRule
return exception.getURI().contains("/yui/");
}
});
return webClient;
}
}
8 changes: 3 additions & 5 deletions war/src/main/scss/modules/side-panel-tasks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ $background-outset: 0.7rem;
padding-left: 2.8rem;
}
}
}

&:has(.jenkins-search__results-container--visible) {
.task-link {
opacity: 0.3;
}
}
#side-panel .jenkins-search__results-container--visible .task-link {
opacity: 0.3;
}

#tasks .task {
Expand Down

0 comments on commit 0ae6ad5

Please sign in to comment.