-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZK-5551: Shadow Component ForEach adds fullfil listeners everytime th…
…e syncModel method is called, doesn't clear them if component is removed
- Loading branch information
1 parent
e544f84
commit 1a777f6
Showing
6 changed files
with
107 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
zktest/src/main/java/org/zkoss/zktest/test2/B101_ZK_5551Composer.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,27 @@ | ||
/* B101_ZK_5551Composer.java | ||
Purpose: | ||
Description: | ||
History: | ||
11:33 AM 2024/9/25, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.test2; | ||
|
||
import org.zkoss.zk.ui.Component; | ||
import org.zkoss.zk.ui.util.Clients; | ||
import org.zkoss.zul.Label; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
public class B101_ZK_5551Composer implements org.zkoss.zk.ui.util.Composer { | ||
public void doAfterCompose(Component comp) { | ||
String itemLabel = (String) comp.getParent().getAttribute("item"); | ||
Clients.log("executing composer for " + comp + " " + itemLabel + " page: " +comp.getPage()); | ||
comp.appendChild(new Label("itemLabel")); | ||
} | ||
} |
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,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5551.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/9/23, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<zscript><![CDATA[ | ||
ListModelList model = new ListModelList(); | ||
int count = 0; | ||
]]></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="org.zkoss.zktest.test2.B101_ZK_5551Composer"/> | ||
</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
39 changes: 39 additions & 0 deletions
39
zktest/src/test/java/org/zkoss/zktest/zats/test2/B101_ZK_5551Test.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,39 @@ | ||
/* B101_ZK_5551Test.java | ||
Purpose: | ||
Description: | ||
History: | ||
5:41 PM 2024/9/24, 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_5551Test extends WebDriverTestCase { | ||
@Test | ||
public void test() { | ||
connect(); | ||
for (int i = 0; i < 3; i++) { | ||
click(jq("@button:eq(0)")); | ||
waitResponse(); | ||
} | ||
click(jq("@button:eq(1)")); | ||
waitResponse(); | ||
click(jq("@button:eq(2)")); | ||
waitResponse(); | ||
String log = getZKLog(); | ||
assertEquals(0, log.split("executing composer for ").length - 1); | ||
|
||
} | ||
} |