ToggleButton states
- ToggleButton
+ ToggleButton
Pressed ToggleButton
Disabled ToggleButton
Disabled ToggleButton
diff --git a/packages/main/test/specs/ColorPalettePopover.spec.js b/packages/main/test/specs/ColorPalettePopover.spec.js
index 488a30ef2387..6bb122c891b5 100644
--- a/packages/main/test/specs/ColorPalettePopover.spec.js
+++ b/packages/main/test/specs/ColorPalettePopover.spec.js
@@ -17,7 +17,7 @@ describe("ColorPalette interactions", () => {
const defaultButton = await colorPalette.shadow$(".ui5-cp-default-color-button");
// assert - default btn is focused
- assert.ok(await defaultButton.getProperty("focused"), "The first element is focused");
+ assert.ok(await defaultButton.matches(":focus"), "The first element is focused");
// act - close popover
await defaultButton.click();
@@ -67,7 +67,7 @@ describe("ColorPalette interactions", () => {
// act - open color palette popover
await colorPaletteButton.click();
-
+
const colorPalettePopover = await browser.$("#colorPalettePopoverTest4");
const colorPalette = await colorPalettePopover.shadow$("[ui5-responsive-popover]").$("[ui5-color-palette]");
const moreColorsButton = await colorPalette.shadow$(".ui5-cp-more-colors");
@@ -76,7 +76,7 @@ describe("ColorPalette interactions", () => {
await defaultButton.keys("ArrowUp");
// assert - MoreColors button is focused
- assert.ok(await moreColorsButton.getProperty("focused"), "Button 'MoreColors' is focused");
+ assert.ok(await moreColorsButton.matches(":focus"), "Button 'MoreColors' is focused");
// act - close popover
await defaultButton.click();
@@ -84,7 +84,7 @@ describe("ColorPalette interactions", () => {
it("Tests navigation with recent colors", async () => {
const colorPaletteButton = await browser.$("#colorPaletteBtnTest5");
-
+
// act - open color palette popover
await colorPaletteButton.click();
@@ -103,7 +103,7 @@ describe("ColorPalette interactions", () => {
await firstRecentColorsElement.keys("ArrowUp");
// assert - MoreColors is focused
- assert.ok(await moreColorsButton.getProperty("focused"), "Check if more colors button is focused");
+ assert.ok(await moreColorsButton.matches(":focus"), "Check if more colors button is focused");
// act - close popover
await defaultButton.click();
@@ -149,5 +149,5 @@ describe("ColorPalette interactions", () => {
assert.ok(await colorPalette.getProperty("showRecentColors"), "Check if recent colors is on");
assert.ok(await colorPalette.getProperty("showMoreColors"), "Check if more colors is on");
})
-
+
});
diff --git a/packages/main/test/specs/Popover.spec.js b/packages/main/test/specs/Popover.spec.js
index f9a6d378c999..87571874f9f3 100644
--- a/packages/main/test/specs/Popover.spec.js
+++ b/packages/main/test/specs/Popover.spec.js
@@ -220,7 +220,7 @@ describe("Popover general interaction", () => {
await btnOpenPopover.click();
- assert.ok(await focusedButton.getProperty("focused"), "The button is focused.");
+ assert.ok(await focusedButton.matches(":focus"), "The button is focused.");
await browser.keys("Escape");
});
@@ -231,17 +231,17 @@ describe("Popover general interaction", () => {
await btn.click();
- assert.ok(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.ok(await ff.matches(":focus"), "The first focusable element is focused.");
// list
await browser.keys("Tab");
- assert.notOk(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.notOk(await ff.matches(":focus"), "The first focusable element is focused.");
// button
await browser.keys("Tab");
- assert.notOk(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.notOk(await ff.matches(":focus"), "The first focusable element is focused.");
// select
await browser.keys("Tab");
@@ -252,7 +252,7 @@ describe("Popover general interaction", () => {
// goes to first focusable again
await browser.keys("Tab");
- assert.ok(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.ok(await ff.matches(":focus"), "The first focusable element is focused.");
await browser.keys("Escape");
});
@@ -263,7 +263,7 @@ describe("Popover general interaction", () => {
await btn.click();
- assert.ok(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.ok(await ff.matches(":focus"), "The first focusable element is focused.");
// footer button
await browser.keys(["Shift", "Tab"]);
@@ -280,7 +280,7 @@ describe("Popover general interaction", () => {
// header button
await browser.keys(["Shift", "Tab"]);
- assert.ok(await ff.getProperty("focused"), "The first focusable element is focused.");
+ assert.ok(await ff.matches(":focus"), "The first focusable element is focused.");
await browser.keys("Escape");
});
diff --git a/packages/main/test/specs/Table.spec.js b/packages/main/test/specs/Table.spec.js
index 8733ddaa1d68..6c868418eedb 100644
--- a/packages/main/test/specs/Table.spec.js
+++ b/packages/main/test/specs/Table.spec.js
@@ -148,10 +148,10 @@ describe("Table general interaction", () => {
await browser.keys("Tab");
await browser.keys("Tab");
- assert.equal(await link.getProperty("focused"), true, "Link is focused")
+ assert.equal(await link.matches(":focus"), true, "Link is focused")
await browser.keys("Tab");
- assert.equal(await afterBtn.getProperty("focused"), true, "Button is focused")
+ assert.equal(await afterBtn.matches(":focus"), true, "Button is focused")
});
it("Should have correct focus handling when having popin rows", async () => {
@@ -162,10 +162,10 @@ describe("Table general interaction", () => {
await input.click();
await browser.keys("Tab");
- assert.equal(await btn.getProperty("focused"), true, "Button is focused")
+ assert.equal(await btn.matches(":focus"), true, "Button is focused")
await browser.keys("Tab");
- assert.equal(await secondInput.getProperty("focused"), true, "Input is focused")
+ assert.equal(await secondInput.matches(":focus"), true, "Input is focused")
});
after(async () => {
diff --git a/packages/main/test/specs/ToggleButton.spec.js b/packages/main/test/specs/ToggleButton.spec.js
index fe1a193c55d5..9280e983886d 100644
--- a/packages/main/test/specs/ToggleButton.spec.js
+++ b/packages/main/test/specs/ToggleButton.spec.js
@@ -10,20 +10,20 @@ describe("ToggleButton general interaction", () => {
const result = await browser.$("#click-result");
await toggleButton.click();
- assert.strictEqual(await result.getText(), "ToggleButton: false", "click event changed pressed state");
+ assert.strictEqual(await result.getText(), "ToggleButton: true", "click event changed pressed state");
await toggleButton.keys("Space");
- assert.strictEqual(await result.getText(), "ToggleButton: true", "Space triggered click and changed pressed state");
+ assert.strictEqual(await result.getText(), "ToggleButton: false", "Space triggered click and changed pressed state");
await toggleButton.keys("Enter");
- assert.strictEqual(await result.getText(), "ToggleButton: false", "Enter triggered click and changed pressed state");
+ assert.strictEqual(await result.getText(), "ToggleButton: true", "Enter triggered click and changed pressed state");
});
it("should not fire click event on a disabled togglebutton", async () => {
const toggleButton = await browser.$("#disabled-toggle-button").shadow$("button");
const result = await browser.$("#click-result");
- assert.strictEqual(await result.getText(), "ToggleButton: false", "toggle state should not change");
+ assert.strictEqual(await result.getText(), "ToggleButton: true", "toggle state should not change");
// don't test space and enter, as wdio always fires a click but the browser not.
diff --git a/packages/tools/components-package/wdio.js b/packages/tools/components-package/wdio.js
index 23c4a21489bd..44ec21eab205 100644
--- a/packages/tools/components-package/wdio.js
+++ b/packages/tools/components-package/wdio.js
@@ -236,6 +236,12 @@ exports.config = {
}, this, attrName);
}, true);
+ await browser.addCommand("matches", async function(selector) {
+ return browser.executeAsync((elem, selector, done) => {
+ done(elem.matches(selector));
+ }, this, selector);
+ }, true);
+
await browser.addCommand("getStaticAreaItemClassName", async function(selector) {
return browser.executeAsync(async (selector, done) => {
const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();