Package io.jmix.flowui.sys
Class UiTestIdSupport
java.lang.Object
io.jmix.flowui.sys.UiTestIdSupport
Support class for calculating and setting a special static ID attribute for testing.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddFragmentIdPrefix(com.vaadin.flow.component.Component component, String id) Adds the prefix of its parentFragmentto the component's ID.voidaddTestIdListener(com.vaadin.flow.component.Component component) Adds a listener to add a special static ID attribute for testing as aUI_TEST_IDattribute of the component.protected StringgetMenuDetailsTestId(com.vaadin.flow.component.details.Details details) Gets a special static ID attribute for testing for aDetailscomponent in the menu.protected voidsetMenuTestId(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for theJmixListMenuandHorizontalMenucomponents and for their nested components (like aDetails,ListItemetc.).protected voidsetTestId(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for passed component.protected voidSets passed UI test ID for the passed UI component as aUI_TEST_IDweb-element attribute.protected voidtestIdListener(com.vaadin.flow.component.AttachEvent attachEvent) Attach event listener for components that adds a special static ID attribute for testing.
-
Field Details
-
UI_TEST_ID
- See Also:
-
uiTestIdManager
-
-
Constructor Details
-
UiTestIdSupport
-
-
Method Details
-
addTestIdListener
public void addTestIdListener(com.vaadin.flow.component.Component component) Adds a listener to add a special static ID attribute for testing as aUI_TEST_IDattribute of the component.Typically it equals to
Component.getId(), but in certain cases it can be calculated from the component state.- Parameters:
component- component for addingUI_TEST_IDattribute
-
testIdListener
protected void testIdListener(com.vaadin.flow.component.AttachEvent attachEvent) Attach event listener for components that adds a special static ID attribute for testing.- Parameters:
attachEvent- attach event
-
setMenuTestId
protected void setMenuTestId(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for theJmixListMenuandHorizontalMenucomponents and for their nested components (like aDetails,ListItemetc.).- Parameters:
component- menu component
-
getMenuDetailsTestId
Gets a special static ID attribute for testing for aDetailscomponent in the menu. ID is calculated based onDetails.getSummaryText()or the summary component.- Parameters:
details-Detailscomponent to calculate UI test ID- Returns:
- special static ID attribute for a
Detailscomponent in the menu
-
setTestId
protected void setTestId(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for passed component.Typically it equals to
Component.getId(), but in certain cases it can be calculated from the component state.If UI test ID already exist, nothing will happen.
- Parameters:
component- component for calculating and setting UI test ID
-
addFragmentIdPrefix
Adds the prefix of its parentFragmentto the component's ID. -
setTestId
Sets passed UI test ID for the passed UI component as aUI_TEST_IDweb-element attribute.- Parameters:
component- component for setting UI test IDtestId- UI test ID for setting
-