-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Miscellaneous content fixes + add a test for content (#379)
- Loading branch information
1 parent
1ceadee
commit 9bfb090
Showing
9 changed files
with
87 additions
and
33 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
src/main/resources/io/jenkins/plugins/designlibrary/AppBar/index.properties
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
topAppBar=Top app bar | ||
topAppBar.description=Top app bar provides the page heading as well as important actions. | ||
topAppBar.do.1=Place your most important actions in the top app bar | ||
topAppBar.do.2=Show a count subtitle if it explicitly relates to your page | ||
topAppBar.dont.1=Avoid showing more than four actions at once, relegate less used actions to an overflow menu | ||
topAppBar.dont.2=Avoid showing a count subtitle if it could relate to multiple things on your page | ||
topAppBar.do.1=Place your most important actions in the top app bar. | ||
topAppBar.do.2=Show a count subtitle if it explicitly relates to your page. | ||
topAppBar.dont.1=Avoid showing more than four actions at once, relegate less used actions to an overflow menu. | ||
topAppBar.dont.2=Avoid showing a count subtitle if it could relate to multiple things on your page. | ||
|
||
bottomAppBar=Bottom app bar | ||
bottomAppBar.description=Bottom app bars are great for forms, they provide important actions for the current page, such as "Save" and "Apply". Bottom app bars stick to the bottom of the screen so that they''re always present. |
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
10 changes: 5 additions & 5 deletions
10
src/main/resources/io/jenkins/plugins/designlibrary/Cards/index.properties
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
16 changes: 8 additions & 8 deletions
16
src/main/resources/io/jenkins/plugins/designlibrary/Layouts/index.properties
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
two-column.do.1=Include a title on your sidebar that best encapsulates its child pages | ||
two-column.do.2=Ensure all child pages share the same sidebar for consistency | ||
two-column.do.3=Buttons should only relate to/manipulate their parent column | ||
two-column.do.4=One (and only one) sidebar item should be in its selected state at a time | ||
two-column.dont.1=Don''t include hierarchical navigation in your sidebar, such as "Back to Dashboard" or "Up" | ||
two-column.dont.2=Don''t include actions or external pages in your sidebar, these belong in the top app bar | ||
two-column.do.1=Include a title on your sidebar that best encapsulates its child pages. | ||
two-column.do.2=Ensure all child pages share the same sidebar for consistency. | ||
two-column.do.3=Buttons should only relate to/manipulate their parent column. | ||
two-column.do.4=One (and only one) sidebar item should be in its selected state at a time. | ||
two-column.dont.1=Don''t include hierarchical navigation in your sidebar, such as "Back to Dashboard" or "Up". | ||
two-column.dont.2=Don''t include actions or external pages in your sidebar, these belong in the top app bar. | ||
|
||
one-column.do.1=Use the "one-column" layout if your page doesn''t need a sidebar | ||
one-column.dont.1=Avoid sprawling content, use tabs if your page is lengthy and can be separated into clearly labelled sections | ||
one-column.do.1=Use the "one-column" layout if your page doesn''t need a sidebar. | ||
one-column.dont.1=Avoid sprawling content, use tabs if your page is lengthy and can be separated into clearly labelled sections. |
10 changes: 5 additions & 5 deletions
10
src/main/resources/io/jenkins/plugins/designlibrary/Menu/index.properties
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
do.1=Use overflow buttons to avoid overcomplicating your page | ||
dont.1=Avoid moving important, commonly used actions to menus | ||
do.2=Use overflow buttons to offer quick access to a subpage''s actions | ||
dont.2=Don''t overcomplicate your menus, avoid using more than one level of submenus | ||
do.3=Use color to emphasise differences between actions | ||
do.1=Use overflow buttons to avoid overcomplicating your page. | ||
dont.1=Avoid moving important, commonly used actions to menus. | ||
do.2=Use overflow buttons to offer quick access to a subpage''s actions. | ||
dont.2=Don''t overcomplicate your menus, avoid using more than one level of submenus. | ||
do.3=Use color to emphasise differences between actions. |
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 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,56 @@ | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; | ||
|
||
import io.jenkins.plugins.designlibrary.UISample; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
import org.htmlunit.html.DomNode; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.TestInstance; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.junit.jupiter.WithJenkins; | ||
|
||
@WithJenkins | ||
@TestInstance(PER_CLASS) | ||
class ContentTest { | ||
|
||
private JenkinsRule jenkins; | ||
|
||
private List<UISample> samples; | ||
|
||
@BeforeAll | ||
void beforeAll(JenkinsRule jenkins) { | ||
this.jenkins = jenkins; | ||
this.samples = jenkins.getInstance().getExtensionList(UISample.class); | ||
} | ||
|
||
/** | ||
* Validate that descriptive elements end with a full stop or a colon | ||
*/ | ||
@ParameterizedTest | ||
@MethodSource("getPages") | ||
void validContent(String url) throws Exception { | ||
try (var webClient = jenkins.createWebClient().withJavaScriptEnabled(false)) { | ||
// We get a bunch of spam in our logs about missing CSS, let's ignore that | ||
webClient.getOptions().setPrintContentOnFailingStatusCode(false); | ||
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); | ||
|
||
var page = webClient.goTo(url); | ||
var links = page.querySelectorAll(".jdl-section__description, .jdl-dos-donts td").stream() | ||
.map(DomNode::getTextContent) | ||
.toList(); | ||
|
||
links.forEach(e -> assertThat(e) | ||
.satisfiesAnyOf(listParam -> assertThat(listParam).endsWith("."), listParam -> assertThat(listParam) | ||
.endsWith(":"))); | ||
} | ||
} | ||
|
||
private Stream<String> getPages() { | ||
Stream<String> homePage = Stream.of("design-library"); | ||
Stream<String> otherItems = samples.stream().map(e -> "design-library/" + e.getUrlName()); | ||
return Stream.concat(homePage, otherItems); | ||
} | ||
} |