Skip to content

Commit

Permalink
Fix side effects of ZK-5025
Browse files Browse the repository at this point in the history
  • Loading branch information
JamsonChan committed Sep 11, 2023
1 parent 940b82b commit f01540a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@
public class B96_ZK_4884Test extends WebDriverTestCase {
@Test
public void test() {
// The highlight class names were used to be all `-hover`, after ZK-5025, it's divided into `-hover` (mouse) and `-focus` (keydown)

connect();

click(jq("$menu1"));
waitResponse();
click(jq("$menuitem1"));
waitResponse();
Assertions.assertEquals(1, jq(".z-menu-hover").length());
Assertions.assertEquals(1, jq(".z-menu-focus").length());

click(jq("$menu2"));
waitResponse();
click(jq("$menuitem2"));
waitResponse();
Assertions.assertEquals(1, jq(".z-menu-hover").length());
Assertions.assertEquals(1, jq(".z-menu-focus").length());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
public class B96_ZK_5026Test extends WebDriverTestCase {
@Test
public void test() {
// The highlight class names were used to be all `-hover`, after ZK-5025, it's divided into `-hover` (mouse) and `-focus` (keydown)

Actions act = new Actions(connect());
act.moveToElement(toElement(jq("$menu"))).perform();
waitResponse();
Expand All @@ -39,10 +41,10 @@ public void test() {
assertTrue(jq(" .z-menuitem.z-menuitem-hover").exists());

act.sendKeys(Keys.DOWN).perform();
assertTrue(jq(".z-menupopup-content > .z-menuitem:nth-child(2)").hasClass("z-menuitem-hover"));
assertTrue(jq(".z-menupopup-content > .z-menuitem:nth-child(2)").hasClass("z-menuitem-focus"));

act.sendKeys(Keys.DOWN).perform();
assertTrue(jq(".z-menupopup-content > .z-menuitem:nth-child(3)").hasClass("z-menuitem-hover"));
assertTrue(jq(".z-menupopup-content > .z-menuitem:nth-child(3)").hasClass("z-menuitem-focus"));

// error happen if bug exists
act.moveToElement(toElement(
Expand All @@ -56,11 +58,8 @@ public void test() {
.perform();

assertTrue(jq(" .z-menuitem.z-menuitem-hover").exists());
JQuery childMenupopup = jq(".z-menupopup-content").eq(1);
act.sendKeys(Keys.DOWN).perform();
assertTrue(childMenupopup.children(".z-menuitem:first-child").hasClass("z-menuitem-hover"));

act.sendKeys(Keys.DOWN).perform();
assertTrue(childMenupopup.children(".z-menuitem:nth-child(2)").hasClass("z-menuitem-hover"));
// After ZK-5025, if hover or focus is removed from the menupopup, the menupopup will automatically close.
// Since the behavior has changed, it's contrary to this test case, so the previous subsequent operations are removed.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
public class F55_ZK_443Test extends WebDriverTestCase {
@Test
public void test() {
// The highlight class names were used to be all `-hover`, after ZK-5025, it's divided into `-hover` (mouse) and `-focus` (keydown)

connect();

click(jq("@menu:first"));
Expand Down Expand Up @@ -59,7 +61,7 @@ public void test() {

click(jq("@button:eq(0)"));
waitResponse();
Assertions.assertTrue(jq("@menu:contains(Project)").hasClass("z-menu-hover"));
Assertions.assertTrue(jq("@menu:contains(Project)").hasClass("z-menu-focus"));

click(jq("@button:eq(1)"));
waitResponse();
Expand Down

0 comments on commit f01540a

Please sign in to comment.