mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 04:22:16 +00:00
[JENKINS-72443] Do not show copy option without visible items (#8763)
Co-authored-by: Daniel Beck <daniel-beck@users.noreply.github.com>
This commit is contained in:
1 parent
0a9497951d
commit
7df7ae4a85
2 files changed
+33
-1
No files matched your search
@@ -48,7 +48,7 @@ THE SOFTWARE.
|
||||
|
||||
<div id="items" class="categories flat" role="radiogroup" aria-labelledby="Items" data-valid="false" />
|
||||
|
||||
<j:if test="${!empty(app.itemMap)}">
|
||||
<j:if test="${!empty(app.items)}">
|
||||
<div class="item-copy">
|
||||
<p class="description">${%CopyOption.description}</p>
|
||||
<div class="add-item-copy">
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package jenkins.model;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import hudson.model.Item;
|
||||
import java.io.IOException;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.jvnet.hudson.test.JenkinsRule;
|
||||
import org.jvnet.hudson.test.MockAuthorizationStrategy;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class NewJobCopyFromTest {
|
||||
@Rule
|
||||
public JenkinsRule j = new JenkinsRule();
|
||||
|
||||
@Test
|
||||
public void checkLabel() throws IOException, SAXException {
|
||||
try (JenkinsRule.WebClient wc = j.createWebClient()) {
|
||||
// no items - validate assertion
|
||||
assertThat(wc.goTo("newJob").getElementById("from"), is(nullValue()));
|
||||
|
||||
// actual test
|
||||
j.createFreeStyleProject();
|
||||
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
|
||||
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().grant(Item.CREATE, Jenkins.READ).everywhere().toEveryone());
|
||||
assertThat(wc.goTo("newJob").getElementById("from"), is(nullValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user