Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
23276180
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
23276180
编写于
11月 19, 2015
作者:
T
Tom Fennelly
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1918 from tfennelly/htmlunit-fixes
[Fixed JENKINS-31631] Handle YUI submit <button> clicks
上级
d00dc71b
7fdb5891
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
28 addition
and
3 deletion
+28
-3
test/pom.xml
test/pom.xml
+6
-0
test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java
...a/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java
+15
-0
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
+7
-3
未找到文件。
test/pom.xml
浏览文件 @
23276180
...
...
@@ -150,6 +150,12 @@ THE SOFTWARE.
<groupId>
org.jvnet.hudson
</groupId>
<artifactId>
embedded-rhino-debugger
</artifactId>
<version>
1.2
</version>
<exclusions>
<exclusion>
<groupId>
org.jvnet.hudson
</groupId>
<artifactId>
htmlunit-core-js
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- for testing JNLP launch. -->
...
...
test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java
浏览文件 @
23276180
...
...
@@ -28,6 +28,9 @@ import com.gargoylesoftware.htmlunit.WebClient;
import
com.gargoylesoftware.htmlunit.WebClientUtil
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
/**
* {@link HtmlElement} helper methods.
...
...
@@ -58,4 +61,16 @@ public class HtmlElementUtil {
WebClientUtil
.
waitForJSExec
(
webClient
);
}
}
/**
* Does the supplied element define the specified HTML "class" name.
* @param element The element to check.
* @param className The HTML "class" name to check for.
* @return {@code true} if the element defines the specified class, otherwise {@code false}.
*/
public
static
boolean
hasClassName
(
HtmlElement
element
,
String
className
)
{
String
classAttribute
=
element
.
getAttribute
(
"class"
);
Set
<
String
>
classes
=
new
HashSet
<>(
Arrays
.
asList
(
classAttribute
.
split
(
" "
)));
return
classes
.
contains
(
className
);
}
}
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
浏览文件 @
23276180
...
...
@@ -37,6 +37,7 @@ import com.gargoylesoftware.htmlunit.WebResponseListener;
import
com.gargoylesoftware.htmlunit.html.DomNode
;
import
com.gargoylesoftware.htmlunit.html.HtmlButton
;
import
com.gargoylesoftware.htmlunit.html.HtmlElement
;
import
com.gargoylesoftware.htmlunit.html.HtmlElementUtil
;
import
com.gargoylesoftware.htmlunit.html.HtmlForm
;
import
com.gargoylesoftware.htmlunit.html.HtmlImage
;
import
com.gargoylesoftware.htmlunit.html.HtmlInput
;
...
...
@@ -1342,8 +1343,11 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
public
HtmlPage
submit
(
HtmlForm
form
,
String
name
)
throws
Exception
{
for
(
HtmlElement
e
:
form
.
getHtmlElementsByTagName
(
"button"
))
{
HtmlElement
p
=
(
HtmlElement
)
e
.
getParentNode
().
getParentNode
();
if
(
e
instanceof
HtmlButton
&&
p
.
getAttribute
(
"name"
).
equals
(
name
))
{
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
(
HtmlButton
)
e
);
if
(
p
.
getAttribute
(
"name"
).
equals
(
name
)
&&
HtmlElementUtil
.
hasClassName
(
p
,
"yui-submit-button"
))
{
// For YUI handled submit buttons, just do a click.
return
(
HtmlPage
)
HtmlElementUtil
.
click
(
e
);
}
else
if
(
e
.
getAttribute
(
"name"
).
equals
(
name
))
{
return
(
HtmlPage
)
HtmlFormUtil
.
submit
(
form
,
e
);
}
}
throw
new
AssertionError
(
"No such submit button with the name "
+
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录