提交 11eb4c72 编写于 作者: K Kohsuke Kawaguchi

testing external script as well

上级 ee43b8e7
......@@ -52,15 +52,20 @@ public class RenderOnDemandTest extends HudsonTestCase {
*/
public void testScript() throws Exception {
HtmlPage p = createWebClient().goTo("self/testScript");
assertNull(p.getElementById("loaded"));
p.getElementById("button").click();
// all AJAX calls complete before the above method returns
assertNotNull(p.getElementById("loaded"));
ScriptResult r = p.executeJavaScript("x");
assertEquals("foo",r.getJavaScriptResult().toString());
assertEquals("xxx",r.getJavaScriptResult().toString());
r = p.executeJavaScript("y");
assertEquals("yyy",r.getJavaScriptResult().toString());
// if you want to test this in the browser
System.out.println("Try http://localhost:"+localPort+"\"self/testScript");
System.out.println("Try http://localhost:"+localPort+"/self/testScript");
interactiveBreak();
}
}
<j:jelly xmlns:j="jelly:core">
y = "yyy";
</j:jelly>
\ No newline at end of file
......@@ -32,6 +32,7 @@ THE SOFTWARE.
<input type="button" value="Test" id="button"/>
<script>
var x = null;
var y = null;
$("button").onclick = function() {
renderOnDemand(document.getElementsBySelector('.lazy')[0]);
}
......@@ -39,10 +40,11 @@ THE SOFTWARE.
<l:renderOnDemand clazz="lazy">
<div id="eye">hello</div>
<div id="loaded">loaded</div>
<script>
x = "foo";
x = "xxx";
</script>
<script src="externalScript"></script>
</l:renderOnDemand>
</l:main-panel>
</l:layout>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册