From e1ee9e6d31c7b053fe3834170a0b643acd6f56f5 Mon Sep 17 00:00:00 2001 From: b14ckster Date: Mon, 4 Sep 2023 14:47:19 +0300 Subject: [PATCH] first methods for select implementation --- .../light/angular/asserts/SelectAssert.java | 9 ++ .../angular/elements/complex/Select.java | 85 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/SelectAssert.java create mode 100644 jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Select.java diff --git a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/SelectAssert.java b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/SelectAssert.java new file mode 100644 index 00000000000..712ee3cfc24 --- /dev/null +++ b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/SelectAssert.java @@ -0,0 +1,9 @@ +package com.epam.jdi.light.angular.asserts; + +import com.epam.jdi.light.angular.elements.complex.Select; +import com.epam.jdi.light.asserts.generic.UIAssert; + +public class SelectAssert extends UIAssert { + + +} diff --git a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Select.java b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Select.java new file mode 100644 index 00000000000..3fe555ea974 --- /dev/null +++ b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Select.java @@ -0,0 +1,85 @@ +package com.epam.jdi.light.angular.elements.complex; + +import com.epam.jdi.light.angular.asserts.SelectAssert; +import com.epam.jdi.light.common.JDIAction; +import com.epam.jdi.light.elements.base.UIBaseElement; +import com.epam.jdi.light.elements.interfaces.base.HasPlaceholder; +import com.epam.jdi.light.elements.interfaces.base.IClickable; + +public class Select extends UIBaseElement implements HasPlaceholder, IClickable { + + @JDIAction + public boolean expanded() { + return core().getAttribute("aria-expanded").equalsIgnoreCase("true"); + } + + @JDIAction + public boolean collapsed() { + return !expanded(); + } + + @JDIAction + public void expand() { + click(); + } + + @JDIAction + public String name() { + return core().getAttribute("name"); + } + + @JDIAction + public String role() { + return core().getAttribute("name"); + } + + @JDIAction + public boolean required() { + return attrs().has("required"); + } + + @JDIAction + public boolean disableRipple() { + return attrs().has("disableripple"); + } + + @JDIAction + public boolean disabled() { + return attrs().has("disabled"); + } + + @JDIAction + public boolean multiple() { + return attrs().has("multiple"); + } + + @JDIAction + public boolean hideSingleSelectionIndicator() { + return attrs().has("hidesingleselectionindicator"); + } + + @JDIAction() + public boolean labelDisabled() { + return core().getAttribute("aria-disabled").equalsIgnoreCase("true"); + } + + @JDIAction + public boolean labelRequired() { + return core().getAttribute("aria-required").equalsIgnoreCase("true"); + } + + @JDIAction + public String label() { + return core().getAttribute("aria-label"); + } + + @Override + public void click() { + core().click(); + } + + @Override + public SelectAssert is() { + return new SelectAssert().set(this); + } +}