Skip to content

Commit

Permalink
4949-refCheckboxCheckStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaElf committed Nov 7, 2023
1 parent 609725d commit c713809
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public RadioButtonAssert color(AngularColors expectedColor) {

@JDIAction("'{name}' element label is in before position")
public RadioButtonAssert radioButtonBeforePosition() {
jdiAssert(element().isRadioButtonBeforePosition(), Matchers.is(true),
jdiAssert(element().hasBeforePosition(), Matchers.is(true),
"Radio button label is not in before position");
return this;
}

@JDIAction("'{name}' element label is in before position")
public RadioButtonAssert radioButtonAfterPosition() {
jdiAssert(element().isRadioButtonBeforePosition(), Matchers.is(false),
jdiAssert(element().hasBeforePosition(), Matchers.is(false),
"Radio button label is not in after position");
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import com.epam.jdi.light.angular.elements.enums.AngularColors;
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.elements.base.UIBaseElement;
import com.epam.jdi.light.elements.common.Label;
import com.epam.jdi.light.elements.interfaces.base.HasLabel;
import org.openqa.selenium.By;

public class RadioButton extends UIBaseElement<RadioButtonAssert> implements HasLabel {
private static final String INPUT_SELECTION_CONTROL = "//input[@type='radio']";
private static final String INPUT_SELECTION_CONTROL = ".//input[@type='radio']";
private static final String LABEL_LOCATOR = "//label";

@Override
public RadioButtonAssert is() {
Expand All @@ -29,19 +31,24 @@ public AngularColors color() {
if (hasClass("mat-primary")) {
return AngularColors.PRIMARY;
}
if (hasClass("mat-warn")) {
if (hasClass("mat-warn")) {
return AngularColors.WARN;
} else
return AngularColors.ACCENT;
}

@JDIAction("'{name}' element label is in before position")
public boolean isRadioButtonBeforePosition() {
public boolean hasBeforePosition() {
return attr("labelposition").equalsIgnoreCase("before");
}

@JDIAction("Click '{name}' radio button")
public void click() {
find(By.cssSelector(".mdc-form-field")).click();
}

@Override
public Label label() {
return new Label().setCore(Label.class, find(LABEL_LOCATOR));
}
}

0 comments on commit c713809

Please sign in to comment.