-
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-5756: a MatchMedia request causes java.lang.IllegalArgumentException
- Loading branch information
1 parent
f6e448a
commit 1366e21
Showing
9 changed files
with
196 additions
and
6 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
31 changes: 31 additions & 0 deletions
31
zktest/src/main/java/org/zkoss/zktest/test2/B101_ZK_5756_Page_A_VM.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,31 @@ | ||
/* B101_ZK_5756_Page_A_VM.java | ||
Purpose: | ||
Description: | ||
History: | ||
5:59 PM 2024/9/19, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.test2; | ||
|
||
import org.zkoss.bind.annotation.MatchMedia; | ||
import org.zkoss.lang.Threads; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
public class B101_ZK_5756_Page_A_VM { | ||
@MatchMedia("all and (min-width: 958px)") | ||
public void beWide(){ | ||
Threads.sleep(500); | ||
} | ||
|
||
@MatchMedia("all and (max-width: 957px)") | ||
public void beNarrow(){ | ||
Threads.sleep(500); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
zktest/src/main/java/org/zkoss/zktest/test2/B101_ZK_5756_Page_B_VM.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,29 @@ | ||
/* B101_ZK_5756_Page_B_VM.java | ||
Purpose: | ||
Description: | ||
History: | ||
6:00 PM 2024/9/19, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.test2; | ||
|
||
import org.zkoss.bind.annotation.MatchMedia; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
public class B101_ZK_5756_Page_B_VM { | ||
@MatchMedia("all and (min-width: 958px)") | ||
public void beWide(){ | ||
|
||
} | ||
|
||
@MatchMedia("all and (max-width: 957px)") | ||
public void beNarrow(){ | ||
|
||
} | ||
} |
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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5756-a.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/9/19, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<div viewModel="@id('vm') @init('org.zkoss.zktest.test2.B101_ZK_5756_Page_A_VM')"> | ||
page a | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5756-b.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/9/19, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk> | ||
<div viewModel="@id('vm')@init('org.zkoss.zktest.test2.B101_ZK_5756_Page_B_VM')"> | ||
page b | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
B101-ZK-5756.zul | ||
Purpose: | ||
Description: | ||
History: | ||
2024/9/19, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
--> | ||
<zk xmlns:n="native" xmlns="http://www.zkoss.org/2005/zul"> | ||
<zscript><![CDATA[ | ||
public class NavigationModel { | ||
private String contentUrl = "B101-ZK-5756-a.zul"; | ||
public String getContentUrl() { | ||
return contentUrl; | ||
} | ||
public void setContentUrl(String contentUrl) { | ||
this.contentUrl = contentUrl; | ||
} | ||
} | ||
NavigationModel navigationModel = new NavigationModel(); | ||
public void toA(){ | ||
navigationModel.setContentUrl("B101-ZK-5756-a.zul"); | ||
BindUtils.postNotifyChange(navigationModel, "contentUrl"); | ||
} | ||
public void toB(){ | ||
navigationModel.setContentUrl("B101-ZK-5756-b.zul"); | ||
BindUtils.postNotifyChange(navigationModel, "contentUrl"); | ||
} | ||
]]></zscript> | ||
<div apply="org.zkoss.bind.BindComposer"> | ||
|
||
<div sclass="sidebar"> | ||
|
||
<radiogroup> | ||
<radio id="r1" label="page a" onCheck="toA()"/> | ||
<radio id="r2" label="page b" onCheck="toB()"/> | ||
</radiogroup> | ||
</div> | ||
<apply templateURI="@load(navigationModel.contentUrl)"/> | ||
</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
35 changes: 35 additions & 0 deletions
35
zktest/src/test/java/org/zkoss/zktest/zats/test2/B101_ZK_5756Test.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,35 @@ | ||
/* B101_ZK_5756Test.java | ||
Purpose: | ||
Description: | ||
History: | ||
3:07 PM 2024/9/20, Created by jumperchen | ||
Copyright (C) 2024 Potix Corporation. All Rights Reserved. | ||
*/ | ||
package org.zkoss.zktest.zats.test2; | ||
|
||
import java.util.Random; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.zkoss.test.webdriver.WebDriverTestCase; | ||
|
||
/** | ||
* @author jumperchen | ||
*/ | ||
public class B101_ZK_5756Test extends WebDriverTestCase { | ||
@Test | ||
public void test() { | ||
connect(); | ||
Random random = new Random(); | ||
for (int i = 0; i < 30; i++) { | ||
check(jq("$r1")); | ||
sleep(random.nextInt(100)); | ||
check(jq("$r2")); | ||
assertNoZKError(); | ||
} | ||
} | ||
} |