Skip to content

Commit

Permalink
ZK-5647: Wrong groupbox layout on touch screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rebecca0201 authored and DevChu committed Feb 20, 2024
1 parent 02607b0 commit 3e0716c
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 6 deletions.
54 changes: 48 additions & 6 deletions zk/src/main/resources/web/js/zk/zk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,30 @@ function override<T extends () => void, U> (dst: T, backup: Record<string, unkno
dst[backup] = src;
return dst;
}
for (var nm in src) {
backup[nm] = dst[nm as string];
dst[nm as string] = src[nm];
if (typeof dst['$init'] == 'function') {
const props: string[] = [];
for (var nm in src) {
backup[nm] = dst[nm as string];
dst[nm as string] = src[nm];
if (backup[nm] == undefined && typeof dst[nm as string] != 'function') {
props.push(nm);
}
}
if (props.length) {
const oldInit = dst['$init'] as unknown as CallableFunction;
dst['$init'] = function (...args: unknown[]) {
oldInit.bind(this)(...args);
// try to apply the properties again
for (var nm of props) {
this[nm] = src![nm] as never;
}
};
}
} else {
for (var nm in src) {
backup[nm] = dst[nm as string];
dst[nm as string] = src[nm];
}
}
return dst;
}
Expand Down Expand Up @@ -898,9 +919,30 @@ _zk.override = override;
*/
_zk.augment = function<D extends Pick<S, keyof D & keyof S>, S> (dst: D, src: S & Pick<D, keyof D & keyof S> & ThisType<D & S>) {
const backup = {} as Pick<D, keyof D & keyof S>;
for (const nm in src) {
backup[nm] = dst[nm as keyof D];
dst[nm] = src[nm as keyof S];
if (typeof dst['$init'] == 'function') {
const props: string[] = [];
for (var nm in src) {
backup[nm] = dst[nm as keyof D];
dst[nm] = src[nm as keyof S];
if (backup[nm] == undefined && typeof dst[nm as keyof D] != 'function') {
props.push(nm);
}
}
if (props.length) {
const oldInit = dst['$init'] as unknown as CallableFunction;
dst['$init'] = function (...args: unknown[]) {
oldInit.bind(this)(...args);
// try to apply the properties again
for (var nm of props) {
this[nm] = src[nm] as never;
}
};
}
} else {
for (const nm in src) {
backup[nm] = dst[nm as keyof D];
dst[nm] = src[nm as keyof S];
}
}
return backup;
};
Expand Down
1 change: 1 addition & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ZK 10.0.0
ZK-5611: Executions.schedule() might fail if it's called by multiple threads
ZK-5639: stepbox wrong color update
ZK-5635: textbox cannot focus on iPad/iPhone
ZK-5647: Wrong groupbox layout on touch screen

* Upgrade Notes
+ Upgrade commons-fileupload to commons-fileupload2-javax 2.0.0-M2 and commons-io to 2.13.0 to support jakarta-friendly uploads
Expand Down
36 changes: 36 additions & 0 deletions zktest/src/main/webapp/test2/B100-ZK-5647.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
B100-ZK-5647.zul
Purpose:
Description:
History:
Fri Feb 16 13:21:29 CST 2024, Created by rebeccalai
Copyright (C) 2024 Potix Corporation. All Rights Reserved.
-->
<zk>
<label multiline="true">
1. open the page on touch screen
2. the mold of the groupbox should be 3d
</label>
<groupbox id="root" mold="3d" open="false" width="420px">
<caption label="Click me to open the groupbox" />
<grid fulfill="root.onOpen">
<columns>
<column label="Feature" hflex="1" />
<column label="Benefits" hflex="3" />
</columns>
<rows>
<row>
<label value="Create On Demand" />
<label value="Components are created only when they are needed,
saving both memory and rendering time." />
</row>
</rows>
</grid>
</groupbox>
The grid will be created when the open the content of groupbox
</zk>
1 change: 1 addition & 0 deletions zktest/src/main/webapp/test2/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3121,6 +3121,7 @@ B90-ZK-4431.zul=A,E,Multislider
##zats##B100-ZK-5480.zul=A,E,cascader,selection,label
##zats##B100-ZK-4355.zul=A,E,timebox,col,default
##zats##B100-ZK-5639.zul=A,E,ForEach,If,Apply,MVVM,Shadow,Bindings,ZKDiffer
##zats##B100-ZK-5647.zul=A,E,groupbox,mold,touch

##
# Features - 3.0.x version
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* B100_ZK_5647Test.java
Purpose:
Description:
History:
Tue Feb 20 15:11:13 CST 2024, Created by rebeccalai
Copyright (C) 2024 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zktest.zats.test2;

import java.util.Collections;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

@ForkJVMTestOnly
public class B100_ZK_5647Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
.setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad"));
}

@Test
public void test() {
connect();
waitResponse();
Assertions.assertTrue(jq("@groupbox").hasClass("z-groupbox-3d"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@

import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B70_ZK_2393Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.Color;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B70_ZK_2963Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@
import java.util.Collections;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B86_ZK_4117Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

@ForkJVMTestOnly
public class B86_ZK_4201Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B95_ZK_4678Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

@ForkJVMTestOnly
public class B95_ZK_4738Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.DockerWebDriverTestCase;
import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B96_ZK_4780Test extends DockerWebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;
import org.zkoss.test.webdriver.ztl.JQuery;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B96_ZK_4781Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;
import org.zkoss.test.webdriver.ztl.Element;

/**
* @author rudyhuang
*/
@ForkJVMTestOnly
public class B96_ZK_4910Test extends WebDriverTestCase {
@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml("/test2/enable-tablet-ui-zk.xml");

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
Expand Down

0 comments on commit 3e0716c

Please sign in to comment.