com.vaadin.flow.component.charts.
Class ChartTester<T extends Chart>
Type Parameters:
T
- component type
Tester for Chart components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Simulates a click on the chart, but not on legend items or points.
void
clickLegendItem
(String item) Simulates a click on the item of the legend with the given text.
void
clickPoint
(String seriesName, String name) Simulates a click on a point on the chart.
getPointValue
(int seriesIndex, String name) Gets the value of the point with given name from the series at given index.
getPointValue
(String seriesName, String name) Gets the value of the point with given name from the series at given index.
getSeriesValues
(int seriesIndex) Gets the values for the series at given index.
getSeriesValues
(String seriesName) Gets the values for the series with the given name.
Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal
-
Constructor Details
-
ChartTester
Wrap given component for testing.
Parameters:
component
- target component
-
-
Method Details
-
getSeriesValues
Gets the values for the series at given index. At the moment only
ListSeries
,DataSeries
andDataProviderSeries
are supported. For all other series types an exception will be thrown. ForDataProviderSeries
Y value is expected to be aNumber
subtype.Parameters:
seriesIndex
- zero-based index of the seriesReturns:
the list of values for the series.
Throws:
IndexOutOfBoundsException
- if series for the given index does not exist.UnsupportedOperationException
- if the chart series at give index is not supported. -
getSeriesValues
Gets the values for the series with the given name. At the moment only
ListSeries
,DataSeries
andDataProviderSeries
are supported. For all other series types an exception will be thrown. ForDataProviderSeries
Y value is expected to be aNumber
subtype.Parameters:
seriesName
- name of the seriesReturns:
the list of values for the series.
Throws:
UnsupportedOperationException
- if the chart series at give index is not supported. -
getPointValue
Gets the value of the point with given name from the series at given index. The
name
depends on the series type. ForListSeries
it is expected to refer to an X-Axis category, forDataSeries
it refers to the item name, forDataProviderSeries
it is matched against the value of the configured x attribute. At the moment onlyListSeries
,DataSeries
andDataProviderSeries
are supported. For all other series types an exception will be thrown.Parameters:
seriesIndex
- zero-based index of the seriesname
- name of the point in the seriesReturns:
the value of the point at given coordinates.
-
getPointValue
Gets the value of the point with given name from the series at given index. The
name
depends on the series type. ForListSeries
it is expected to refer to an X-Axis category, forDataSeries
it refers to the item name, forDataProviderSeries
it is matched against the value of the configured x attribute. At the moment onlyListSeries
,DataSeries
andDataProviderSeries
are supported. For all other series types an exception will be thrown.Parameters:
seriesName
- name of the seriesname
- name of the point in the seriesReturns:
the value of the point at given coordinates.
-
clickLegendItem
Simulates a click on the item of the legend with the given text. Current limitation: it assumes the text corresponds to a series name.
Parameters:
item
- legend item -
clickPoint
Simulates a click on a point on the chart.
Parameters:
seriesName
- name of the seriesname
- name of the point in the series -
clickChart
public void clickChart()Simulates a click on the chart, but not on legend items or points.
-