Skip to content

Commit

Permalink
4934_toggleSlideRefacWithAssert
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaElf committed Dec 14, 2023
1 parent 5d79f6c commit 2a41667
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.epam.jdi.light.angular.asserts;

import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;

import com.epam.jdi.light.angular.elements.common.SlideToggle;
import com.epam.jdi.light.asserts.generic.UIAssert;
import com.epam.jdi.light.common.JDIAction;
import org.hamcrest.Matchers;

public class SlideToggleAssert extends UIAssert<SlideToggleAssert, SlideToggle> {

@Override
@JDIAction("Assert that '{name}' is disabled")
public SlideToggleAssert disabled() {
jdiAssert(element().isDisabled(), Matchers.is(true), "Element is enabled");
return this;
}

@Override
@JDIAction("Assert that '{name}' is disabled")
public SlideToggleAssert enabled() {
jdiAssert(element().isDisabled(), Matchers.is(false), "Element is disabled");
return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.epam.jdi.light.angular.elements.common;

import com.epam.jdi.light.elements.common.UIElement;
import com.epam.jdi.light.ui.html.elements.common.Checkbox;

/**
Expand All @@ -15,15 +16,13 @@ public boolean isSelected() {

@Override
public boolean isEnabled() {
if (hasClass("mat-disabled")) {
return false;
}
return super.isEnabled();
return !isDisabled();
}

@Override
public boolean isDisabled() {
return !isEnabled();
UIElement e = find("//button");
return e.hasAttribute("disabled");
}

@Override
Expand Down

0 comments on commit 2a41667

Please sign in to comment.