Test Included ZUL"

From Documentation
(Created page with "{{ZATSEssentialsPageHeader}} Since 1.1.0 ZK provides the <javadoc>org.zkoss.zul.Include</javadoc> component<ref>For more details, please refer to [[ZK_Developer%27s_Reference/...")
 
Line 1: Line 1:
 +
{{Template:UnderConstruction}}
 
{{ZATSEssentialsPageHeader}}
 
{{ZATSEssentialsPageHeader}}
 
  Since 1.1.0
 
  Since 1.1.0

Revision as of 03:13, 9 July 2012

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!


Since 1.1.0


ZK provides the Include component[1] and Execution.createComponents(String, Component, Map) method[2] to include and reuse ZUL pages or others. In ZATS Mimic, we can test ZUL pages which are included by outer pages directly; just connect to such ZUL pages through the Client.connect(String) method as usual.

Test Included ZUL Pages with Arguments

Sometimes, we pass some arguments to included ZUL pages for flexibility, and the arguments can be retrieved from the implicit objects arg in such ZUL pages. ZATS Mimic introduces another connecting method Client.connectAsIncluded(String, Map<String, Object>) for above case. Following is a typical example of connecting to a included ZUL page with specific arguments:

included.zul

<zk>
	<label id="msg" value="${arg.message }" />
</zk>
  • Line 2: The value is retrieved from arguments.


Test.java

@Test
public void test() {
	Map<String, Object> args = new HashMap<String, Object>();
	args.put("message", "Hello world!");
	Client client = Zats.newClient();
	DesktopAgent desktop = client.connectAsIncluded("/included.zul", args);
	Label msg = desktop.query("#msg").as(Label.class);
	Assert.assertEquals("Hello world!", msg.getValue());
}
  • Line 12-13: Prepare arguments for included ZUL page.
  • Line 15: Connect to included ZUL page with arguments.


Notes




Last Update : 2012/07/09

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.