Skip to content

Commit

Permalink
#5470 fix MuiList
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed May 2, 2024
1 parent 8187662 commit 60f8c70
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public class MUIListItemWithDialog extends ListItem implements ISetup, HasDialog
protected String root = "//div[contains(@class, 'MuiListItem-root')";
protected String dialogLocator = "//div[contains(@class, 'MuiDialog-container')";

public MUIListItemWithDialog() {
super();
}

public MUIListItemWithDialog(UIElement base) {
setCore(MUIListItemWithDialog.class, base);
}

@Override
public void setup(Field field) {
if (!fieldHasAnnotation(field, JListItemWithDialog.class, MUIListItemWithDialog.class)) {
Expand All @@ -28,6 +36,7 @@ public void setup(Field field) {
base().setLocator(root);
}


@JDIAction("Get '{name}'s dialog")
@Override
public Dialog dialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.elements.base.UIBaseElement;
import com.epam.jdi.light.elements.common.UIElement;
import com.epam.jdi.light.elements.interfaces.base.HasClick;
import com.epam.jdi.light.elements.interfaces.common.IsText;
import com.epam.jdi.light.material.asserts.displaydata.ListItemAssert;
Expand Down Expand Up @@ -36,6 +37,13 @@ public class ListItem extends UIBaseElement<ListItemAssert> implements IsText, H
private static final String ICON_LOCATOR = ".MuiListItemIcon-root > .MuiSvgIcon-root";
private static final String TEXT_LOCATOR = ".MuiTypography-root";

public ListItem() {
super();
}
public ListItem(UIElement base) {
setCore(ListItem.class, base);
}

@Override
@JDIAction("Get '{name}' text")
public String getText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class Menu extends UIListBase<MenuAssert> {
public ListItem item(String name) {
return items().stream()
.filter(item -> item.getText().equals(name))
.findFirst()
.orElse(new ListItem());
.findFirst().orElseThrow();
}

/**
Expand All @@ -51,7 +50,7 @@ public ListItem item(int index) {
@JDIAction("Get '{name}' items")
public List<ListItem> items() {
return core().finds(".MuiListItem-root").stream()
.map(listItem -> new ListItem().setCore(ListItem.class, listItem))
.map(listItem -> new ListItem(listItem))
.collect(Collectors.toList());
}

Expand Down

0 comments on commit 60f8c70

Please sign in to comment.