Skip to content

Commit 86d62dd

Browse files
committed
4911_radioButtonsTestsRefCommentsFixIncaps
1 parent 9af45cb commit 86d62dd

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/radiobuttons/RadioButton.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public AngularColors color() {
4040
return AngularColors.UNDEFINED;
4141
}
4242

43+
@JDIAction("Get radio-button value")
44+
public String value() {
45+
return find("input").attr("value");
46+
}
47+
4348
@JDIAction("'{name}' element label is in before position")
4449
public boolean hasBeforePosition() {
4550
return core().find(FORM_FIELD_LOCATOR).hasClass("mdc-form-field--align-end");

jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/radiobuttons/RadioGroup.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,22 @@ public void click(String value) {
2020

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

26-
@JDIAction("Get radio-button by value {0}")
26+
@JDIAction("Get radio-button by value '{0}'")
2727
public RadioButton getRadioButtonByValue(String value) {
28-
RadioButton radioButton = null;
29-
for (RadioButton e : radioButtons()) {
30-
if (e.find("input").attr("value").equalsIgnoreCase(value)) {
31-
radioButton = e;
32-
}
33-
}
34-
return radioButton;
28+
return radioButtons().stream()
29+
.filter(radioButton -> radioButton.value().equalsIgnoreCase(value))
30+
.findFirst()
31+
.orElse(null);
3532
}
36-
3733
@JDIAction("Get '{name}' checked radio-button")
3834
public RadioButton getCheckedRadioButton() {
39-
RadioButton radioButton = null;
40-
for (RadioButton e : radioButtons()) {
41-
if (e.isChecked()) {
42-
radioButton = e;
43-
}
44-
}
45-
return radioButton;
35+
return radioButtons().stream()
36+
.filter(RadioButton::isChecked)
37+
.findFirst()
38+
.orElse(null);
4639
}
4740

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

52+
@Override
5953
@JDIAction("'{name}' is disabled")
6054
public boolean isDisabled() {
6155
return core().hasAttribute("disabled");
6256
}
6357

58+
@Override
59+
@JDIAction("'{name}' is enabled")
60+
public boolean isEnabled() { return core().hasAttribute("enabled"); }
61+
6462
@JDIAction("'{name}' is required")
6563
public boolean isRequired() {
6664
return core().hasAttribute("required");

0 commit comments

Comments
 (0)