-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZK-5792: fullfill doesn't create all components in a forEach
- Loading branch information
1 parent
4d3a590
commit 9319e4d
Showing
9 changed files
with
125 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5792.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/9/25, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<zscript><![CDATA[ | ||
ListModelList model = new ListModelList(); | ||
int count = 0; | ||
class MyComp implements org.zkoss.zk.ui.util.Composer { | ||
public void doAfterCompose(Component comp) { | ||
String itemLabel = comp.getParent().getAttribute("item"); | ||
Clients.log("executing composer for " + comp + " " + itemLabel); | ||
comp.appendChild(new Label("itemLabel")); | ||
} | ||
} | ||
MyComp myComposer = new MyComp(); | ||
]]></zscript> | ||
|
||
<button label="add dynamic item" onClick='model.add("item-" + ++count)'/> | ||
<button label="clear model" onClick='model.clear()'/> | ||
<button id="renderAll" label="render all"/> | ||
|
||
<div> | ||
<forEach items="${model}"> | ||
<div style="border: 1px solid red; height: 20px;" | ||
fulfill="renderAll.onClick"> | ||
<custom-attributes item="${each}"/> | ||
<div apply="${myComposer}"/> | ||
</div> | ||
</forEach> | ||
</div> | ||
</zk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
zktest/src/test/java/org/zkoss/zktest/zats/test2/B101_ZK_5792Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* B101_ZK_5792Test.java | ||
Purpose: | ||
Description: | ||
History: | ||
3:30 PM 2024/9/25, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.zats.test2; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.zkoss.test.webdriver.WebDriverTestCase; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
public class B101_ZK_5792Test extends WebDriverTestCase { | ||
@Test | ||
public void test() { | ||
connect(); | ||
for (int i = 1; i < 6; i++) { | ||
click(jq("@button:eq(0)")); | ||
waitResponse(); | ||
assertEquals(1 + i , jq(".z-div").length()); | ||
click(jq("@button:eq(2)")); | ||
waitResponse(); | ||
assertEquals(i, jq(".z-label:contains(itemLabel)").length()); | ||
} | ||
} | ||
} |