Skip to content

Commit

Permalink
add V6 flag to all tested components in Material UI
Browse files Browse the repository at this point in the history
  • Loading branch information
grossopa committed Dec 15, 2024
1 parent dec0dc3 commit b83d8c6
Show file tree
Hide file tree
Showing 86 changed files with 201 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,20 @@ public MuiDatePickerFormField toDatePickerFormField(ViewType... views) {
/**
* Wraps the current {@link WebComponent} to {@link MuiGrid} instance.
*
* <p>It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.</p>
*
* @return wrapped {@link MuiGrid} instance on the given component
*/
public MuiGrid toGrid() {

return new MuiGrid(component, driver, config);
}

/**
* Wraps the current {@link WebComponent} to {@link MuiPager}.
*
* <p>It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.</p>
*
* @return the wrapped {@link MuiPager} instance on the given component
*/
public MuiPager toPager() {
Expand All @@ -940,6 +945,8 @@ public MuiPager toPager() {
/**
* Wraps the current {@link WebComponent} to {@link MuiPickersDialog}.
*
* <p>It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.</p>
*
* @return the wrapped {@link MuiPickersDialog} instance on the given component
*/
public MuiPickersDialog toPickersDialog() {
Expand All @@ -949,6 +956,8 @@ public MuiPickersDialog toPickersDialog() {
/**
* Wraps the current {@link WebComponent} to {@link MuiPickersDialog}.
*
* <p>It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.</p>
*
* @return the wrapped {@link MuiPickersDialog} instance on the given component
*/
public MuiTooltip toTooltip() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,25 @@ public <T, R> R apply(Func<T, R> func, T input) {
public <T, R> R apply(Func<T, R> func, T input) {
return func.applyV5(input);
}
},

/**
* Version 6 current version as of year 2024, all V4 and V5 components are fully compatible with V6.
*/
V6 {
@Override
public <T, R> R apply(Func<T, R> func, T input) {
return func.applyV6(input);
}
};

/**
* Executes a function by current type.
*
* @param func the function to execute
* @param func the function to execute
* @param input the input parameter to be passed in
* @param <T> the input type
* @param <R> the result type
* @param <T> the input type
* @param <R> the result type
* @return execution result
*/
public abstract <T, R> R apply(Func<T, R> func, T input);
Expand Down Expand Up @@ -86,5 +96,13 @@ public interface Func<T, R> {
* @return the execution result
*/
R applyV5(T input);

/**
* applies to {@link #V6}.
*
* @param input the input params
* @return the execution result
*/
R applyV6(T input);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
import java.util.EnumSet;
import java.util.Set;

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.*;
import static com.github.grossopa.selenium.core.util.SeleniumUtils.executeIgnoringStaleElementReference;
import static org.openqa.selenium.Keys.ESCAPE;

Expand All @@ -59,7 +58,7 @@ protected MuiModal(WebElement element, ComponentWebDriver driver, MuiConfig conf

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* A Popover can be used to display some content on top of another.
Expand Down Expand Up @@ -61,7 +62,7 @@ protected MuiPopover(WebElement element, ComponentWebDriver driver, MuiConfig co

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Avatars are found throughout material design with uses in everything from tables to dialog menus.
Expand Down Expand Up @@ -71,7 +72,7 @@ public MuiAvatar(WebElement element, ComponentWebDriver driver, MuiConfig config

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import static java.util.Arrays.stream;
import static org.apache.commons.lang3.StringUtils.endsWith;
import static org.apache.commons.lang3.math.NumberUtils.isParsable;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Badge generates a small badge to the top-right of its child(ren).
Expand Down Expand Up @@ -70,7 +71,7 @@ public MuiBadge(WebElement element, ComponentWebDriver driver, MuiConfig config)

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Chips are compact elements that represent an input, attribute, or action.
Expand Down Expand Up @@ -65,7 +66,7 @@ public MuiChip(WebElement element, ComponentWebDriver driver, MuiConfig config)

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Guidance and suggestions for using icons with Material-UI.
Expand Down Expand Up @@ -63,7 +64,7 @@ public MuiDivider(WebElement element, ComponentWebDriver driver, MuiConfig confi

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static java.util.stream.Collectors.toList;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Lists are continuous, vertical indexes of text or images.
Expand Down Expand Up @@ -67,7 +68,7 @@ public MuiList(WebElement element, ComponentWebDriver driver, MuiConfig config)

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* The item belongs to {@link MuiList}.
Expand Down Expand Up @@ -62,7 +63,7 @@ public MuiListItem(WebElement element, ComponentWebDriver driver, MuiConfig conf

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Tooltips display informative text when users hover over, focus on, or tap an element.
Expand Down Expand Up @@ -68,7 +69,7 @@ public boolean validate() {

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* The backdrop component is used to provide emphasis on a particular element or parts of it.
Expand Down Expand Up @@ -63,7 +64,7 @@ public MuiBackdrop(WebElement element, ComponentWebDriver driver, MuiConfig conf

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple
Expand Down Expand Up @@ -67,7 +68,7 @@ public MuiDialog(WebElement element, ComponentWebDriver driver, MuiConfig config

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.core.util.SeleniumUtils.executeIgnoringStaleElementReference;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* Snackbars provide brief messages about app processes. The component is also known as a toast.
Expand Down Expand Up @@ -72,7 +73,7 @@ public MuiSnackbar(WebElement element, ComponentWebDriver driver, MuiConfig conf

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
import java.util.EnumSet;
import java.util.Set;

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.*;

/**
* The content element of {@link MuiSnackbar}.
Expand Down Expand Up @@ -64,7 +63,7 @@ public MuiSnackbarContent(WebElement element, ComponentWebDriver driver, MuiConf

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* a simple Material UI button
Expand Down Expand Up @@ -69,7 +70,7 @@ public String getComponentName() {

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static java.util.stream.Collectors.toList;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* The Material UI Basic ButtonGroup implementation.
Expand Down Expand Up @@ -71,7 +72,7 @@ public String getComponentName() {

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* A floating action button (FAB) performs the primary, or most common, action on a screen.
Expand Down Expand Up @@ -69,6 +70,6 @@ public String getComponentName() {

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import static com.github.grossopa.selenium.component.mui.MuiVersion.V4;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* The Material UI Radio implementation
Expand Down Expand Up @@ -64,7 +65,7 @@ public MuiRadio(WebElement element, ComponentWebDriver driver, MuiConfig config)

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import static com.github.grossopa.selenium.component.mui.MuiVersion.V5;
import static com.github.grossopa.selenium.core.consts.HtmlConstants.CLASS;
import static java.util.stream.Collectors.toList;
import static com.github.grossopa.selenium.component.mui.MuiVersion.V6;

/**
* The Material UI Radio implementation
Expand Down Expand Up @@ -67,7 +68,7 @@ public MuiRadioGroup(WebElement element, ComponentWebDriver driver, MuiConfig co

@Override
public Set<MuiVersion> versions() {
return EnumSet.of(V4, V5);
return EnumSet.of(V4, V5, V6);
}

@Override
Expand Down
Loading

0 comments on commit b83d8c6

Please sign in to comment.