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 String
addFragmentIdPrefix
(com.vaadin.flow.component.Component component, String id) Adds the prefix of its parentFragment
to the component's ID.void
addTestIdListener
(com.vaadin.flow.component.Component component) Adds a listener to add a special static ID attribute for testing as aUI_TEST_ID
attribute of the component.protected String
getMenuDetailsTestId
(com.vaadin.flow.component.details.Details details) Gets a special static ID attribute for testing for aDetails
component in the menu.protected void
setMenuTestId
(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for theJmixListMenu
andHorizontalMenu
components and for their nested components (like aDetails
,ListItem
etc.).protected void
setTestId
(com.vaadin.flow.component.Component component) Sets a special static ID attribute for testing for passed component.protected void
Sets passed UI test ID for the passed UI component as aUI_TEST_ID
web-element attribute.protected void
testIdListener
(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_ID
attribute 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_ID
attribute
-
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 theJmixListMenu
andHorizontalMenu
components and for their nested components (like aDetails
,ListItem
etc.).- Parameters:
component
- menu component
-
getMenuDetailsTestId
Gets a special static ID attribute for testing for aDetails
component in the menu. ID is calculated based onDetails.getSummaryText()
or the summary component.- Parameters:
details
-Details
component to calculate UI test ID- Returns:
- special static ID attribute for a
Details
component 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 parentFragment
to the component's ID. -
setTestId
Sets passed UI test ID for the passed UI component as aUI_TEST_ID
web-element attribute.- Parameters:
component
- component for setting UI test IDtestId
- UI test ID for setting
-