Skip to content

Commit

Permalink
ZK-5354: Update animation implementation to avoid iframe reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
rebecca0201 committed Sep 7, 2023
1 parent 00bdb92 commit 9429005
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zk/src/main/resources/web/js/zk/anima.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@ export namespace anima_global {
// The methods are borrowed from jquery-ui ui/effect.js, MIT license.
/** @internal */
_createWrapper(element: JQuery): JQuery {
// ZK-5354: Update animation implementation to avoid iframe reloading
if (element.find('iframe').length) {
return element;
}

// If the element is already wrapped, return it
var wrapped = element.children('.ui-effects-wrapper');
if (wrapped.length) {
Expand Down
1 change: 1 addition & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ZK 10.0.0
ZK-4928: expose widget private functions and variables as public ones
ZK-5119: Integrate Font Awesome 6 free icons
ZK-5541: Move widget restriction check to Client MVVM
ZK-5354: Update animation implementation to avoid iframe reloading

* Bugs
ZK-5089: AfterSizeEvent doesn't return a correct size of a Window component
Expand Down
27 changes: 27 additions & 0 deletions zktest/src/main/java/org/zkoss/zktest/test2/F100_ZK_5354VM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* F100_ZK_5354VM.java
Purpose:
Description:
History:
Wed Sep 06 15:27:17 CST 2023, Created by rebeccalai
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zktest.test2;

import org.zkoss.bind.annotation.Init;

public class F100_ZK_5354VM {
private static int initCount = 0;

public int getInitCount() {
return initCount;
}

@Init
public void init() {
initCount++;
}
}
18 changes: 18 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5354-1.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
F100-ZK-5354-1.zul
Purpose:
Description:
History:
Thu Sep 07 10:23:16 CST 2023, Created by rebeccalai
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
-->
<zk>
<div viewModel="@id('vm') @init('org.zkoss.zktest.test2.F100_ZK_5354VM')">
initCount = <label id="initCount" value="@load(vm.initCount)"/>
</div>
</zk>
39 changes: 39 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5354-2.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
F100-ZK-5354-2.zul
Purpose:
Description:
History:
Thu Sep 07 11:25:36 CST 2023, Created by rebeccalai
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
-->
<zk>
<label multiline="true">
1. click the second tab to expand
2. click the third tab to expand
3. no js error (else bug exists)
</label>
<tabbox mold="accordion">
<tabs>
<tab iconSclass="z-icon-users" label="First tab"/>
<tab iconSclass="z-icon-graduation-cap" label="Second tab"/>
<tab iconSclass="z-icon-star-half-o" label="Third tab"/>
</tabs>
<tabpanels>
<tabpanel>
<ckeditor id="ck1" height="100%" width="100%" />
</tabpanel>
<tabpanel>
<ckeditor id="ck2" height="100%" width="100%" />
</tabpanel>
<tabpanel>
<ckeditor id="ck3" height="100%" width="100%"/>
</tabpanel>
</tabpanels>
</tabbox>
<custom-attributes org.zkoss.zul.client.rod="false" />
</zk>
28 changes: 28 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5354.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
F100-ZK-5354.zul
Purpose:
Description:
History:
Tue Aug 22 11:38:29 CST 2023, Created by rebeccalai
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
-->
<zk>
<label multiline="true">
1. click the angle icon to collapse east
2. click the angle icon to expand east
3. initCount should remain unchanged (else bug exists)
</label>
<borderlayout>
<center>
center
</center>
<east collapsible="true" title="iframe">
<iframe src="F100-ZK-5354-1.zul"/>
</east>
</borderlayout>
</zk>
2 changes: 2 additions & 0 deletions zktest/src/main/webapp/test2/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3779,6 +3779,8 @@ F86-ZK-4235.zul=A,E,datefmt,library-property
##zats##F100-ZK-5213.zul=A,E,a11y,tooltip,icon
##manually##F100-ZK-5119-1.zul=A,E,FontAwesome4,FontAwesome6,fa4,fa6
##manually##F100-ZK-5119-2.zul=A,E,FontAwesome6,fa6
##zats##F100-ZK-5354.zul=A,E,Iframe,Animation,reload
##zats##F100-ZK-5354-2.zul=A,E,Ckeditor,Animation,reload

# Complex Test Case
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* F100_ZK_5354Test.java
Purpose:
Description:
History:
Tue Sep 05 13:47:51 CST 2023, Created by rebeccalai
Copyright (C) 2023 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;

public class F100_ZK_5354Test extends WebDriverTestCase {
@Test
public void test1() throws Exception {
connect();
waitResponse();
String initCountBefore = jq("@iframe").contents().find("span").text();
click(jq(".z-icon-angle-double-right"));
waitResponse();
click(jq(".z-icon-angle-double-left"));
waitResponse();
String initCountAfter = jq("@iframe").contents().find("span").text();
System.out.println(initCountBefore + " vs " + initCountAfter);
assertEquals(initCountBefore, initCountAfter);
}

@Test
public void test2() throws Exception {
connect("/test2/F100-ZK-5354-2.zul");
waitResponse();
click(jq("@tab:eq(1)"));
waitResponse();
click(jq("@tab:eq(2)"));
waitResponse();
assertNoJSError();
}
}

0 comments on commit 9429005

Please sign in to comment.