Skip to content

Commit

Permalink
4911_radioButtonsTestsRefCommentsFixIncaps
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaElf committed Nov 17, 2023
1 parent 9af45cb commit 86d62dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public AngularColors color() {
return AngularColors.UNDEFINED;
}

@JDIAction("Get radio-button value")
public String value() {
return find("input").attr("value");
}

@JDIAction("'{name}' element label is in before position")
public boolean hasBeforePosition() {
return core().find(FORM_FIELD_LOCATOR).hasClass("mdc-form-field--align-end");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,22 @@ public void click(String value) {

@JDIAction("'{name}' radio button with value '{0}' is checked")
public boolean isChecked(String value) {
return getRadioButtonByValue(value).attr("class").contains("mat-mdc-radio-checked");
return getRadioButtonByValue(value).isChecked();
}

@JDIAction("Get radio-button by value {0}")
@JDIAction("Get radio-button by value '{0}'")
public RadioButton getRadioButtonByValue(String value) {
RadioButton radioButton = null;
for (RadioButton e : radioButtons()) {
if (e.find("input").attr("value").equalsIgnoreCase(value)) {
radioButton = e;
}
}
return radioButton;
return radioButtons().stream()
.filter(radioButton -> radioButton.value().equalsIgnoreCase(value))
.findFirst()
.orElse(null);
}

@JDIAction("Get '{name}' checked radio-button")
public RadioButton getCheckedRadioButton() {
RadioButton radioButton = null;
for (RadioButton e : radioButtons()) {
if (e.isChecked()) {
radioButton = e;
}
}
return radioButton;
return radioButtons().stream()
.filter(RadioButton::isChecked)
.findFirst()
.orElse(null);
}

public List<RadioButton> radioButtons() {
Expand All @@ -56,11 +49,16 @@ public boolean isGroupBeforePosition() {
return core().attr("labelposition").equalsIgnoreCase("before");
}

@Override
@JDIAction("'{name}' is disabled")
public boolean isDisabled() {
return core().hasAttribute("disabled");
}

@Override
@JDIAction("'{name}' is enabled")
public boolean isEnabled() { return core().hasAttribute("enabled"); }

@JDIAction("'{name}' is required")
public boolean isRequired() {
return core().hasAttribute("required");
Expand Down

0 comments on commit 86d62dd

Please sign in to comment.