From f386fe3a2002228b87b359553a2cea582513a265 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 31 Mar 2009 04:54:14 +0000 Subject: [PATCH] Drop-down combobox to select a repository browser all had the same title. See http://www.nabble.com/Possible-bug--Showing-%22Associated-Mantis-Website%22-in-scm-repository-browser-tt22786295.html git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16754 71c3de6d-444a-0410-be80-ed276b4c234a --- .../lib/hudson/listScmBrowsers.jelly | 2 +- .../java/lib/hudson/ListScmBrowsersTest.java | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/src/test/java/lib/hudson/ListScmBrowsersTest.java diff --git a/core/src/main/resources/lib/hudson/listScmBrowsers.jelly b/core/src/main/resources/lib/hudson/listScmBrowsers.jelly index a43a17e5b6..512fd14edc 100644 --- a/core/src/main/resources/lib/hudson/listScmBrowsers.jelly +++ b/core/src/main/resources/lib/hudson/listScmBrowsers.jelly @@ -32,7 +32,7 @@ THE SOFTWARE. - + diff --git a/test/src/test/java/lib/hudson/ListScmBrowsersTest.java b/test/src/test/java/lib/hudson/ListScmBrowsersTest.java new file mode 100644 index 0000000000..b7ae9c00f9 --- /dev/null +++ b/test/src/test/java/lib/hudson/ListScmBrowsersTest.java @@ -0,0 +1,42 @@ +package lib.hudson; + +import com.gargoylesoftware.htmlunit.html.HtmlOption; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlSelect; +import hudson.model.Item; +import org.jvnet.hudson.test.HudsonTestCase; +import org.xml.sax.SAXException; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.io.IOException; + +/** + * @author Kohsuke Kawaguchi + */ +public class ListScmBrowsersTest extends HudsonTestCase { + public void testSelectBoxesUnique() throws Exception { + check(createFreeStyleProject()); + } + + public void testSelectBoxesUnique2() throws Exception { + check(createMavenProject()); + } + + public void testSelectBoxesUnique3() throws Exception { + check(createMatrixProject()); + } + + private void check(Item p) throws IOException, SAXException { + HtmlPage page = new WebClient().getPage(p, "configure"); + List selects = (List)page.selectNodes("//select"); + assertTrue(selects.size()>0); + for (HtmlSelect select : selects) { + Set title = new HashSet(); + for(HtmlOption o : select.getOptions()) { + assertTrue("Duplicate entry: "+o.asText(),title.add(o.asText())); + } + } + } +} -- GitLab