Search in sources :

Example 1 with HasItem

use of com.vaadin.flow.component.charts.events.HasItem in project flow-components by vaadin.

the class HasItemTest method getSeries.

@Test
public void getSeries() {
    Chart chart = new Chart();
    DataSeries series = new DataSeries();
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    Series result = hasItem.getSeries();
    Assert.assertEquals(series, result);
}
Also used : TreeSeries(com.vaadin.flow.component.charts.model.TreeSeries) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) Series(com.vaadin.flow.component.charts.model.Series) NodeSeries(com.vaadin.flow.component.charts.model.NodeSeries) HasItem(com.vaadin.flow.component.charts.events.HasItem) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Test(org.junit.Test)

Example 2 with HasItem

use of com.vaadin.flow.component.charts.events.HasItem in project flow-components by vaadin.

the class HasItemTest method getItemWithListSeriesThrowsUnsupportedOperationException.

@Test(expected = UnsupportedOperationException.class)
public void getItemWithListSeriesThrowsUnsupportedOperationException() {
    Chart chart = new Chart();
    ListSeries series = new ListSeries(1, 2, 3);
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    hasItem.getItem();
}
Also used : HasItem(com.vaadin.flow.component.charts.events.HasItem) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) Test(org.junit.Test)

Example 3 with HasItem

use of com.vaadin.flow.component.charts.events.HasItem in project flow-components by vaadin.

the class HasItemTest method getItemWithDataSeries.

@Test
public void getItemWithDataSeries() {
    Chart chart = new Chart();
    DataSeriesItem item = new DataSeriesItem(5, 10);
    DataSeries series = new DataSeries(item);
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    DataSeriesItem result = hasItem.getItem();
    Assert.assertEquals(item, result);
}
Also used : HasItem(com.vaadin.flow.component.charts.events.HasItem) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem) Test(org.junit.Test)

Example 4 with HasItem

use of com.vaadin.flow.component.charts.events.HasItem in project flow-components by vaadin.

the class HasItemTest method getItemWithNodeSeriesThrowsUnsupportedOperationException.

@Test(expected = UnsupportedOperationException.class)
public void getItemWithNodeSeriesThrowsUnsupportedOperationException() {
    Chart chart = new Chart();
    Node node1 = new Node("Node1");
    Node node2 = new Node("Node2");
    NodeSeries series = new NodeSeries();
    series.add(node1, node2);
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    hasItem.getItem();
}
Also used : HasItem(com.vaadin.flow.component.charts.events.HasItem) Node(com.vaadin.flow.component.charts.model.Node) NodeSeries(com.vaadin.flow.component.charts.model.NodeSeries) Test(org.junit.Test)

Example 5 with HasItem

use of com.vaadin.flow.component.charts.events.HasItem in project flow-components by vaadin.

the class HasItemTest method getItemWithTreeSeriesThrowsUnsupportedOperationException.

@Test(expected = UnsupportedOperationException.class)
public void getItemWithTreeSeriesThrowsUnsupportedOperationException() {
    Chart chart = new Chart();
    TreeSeriesItem item = new TreeSeriesItem("1", "1");
    TreeSeries series = new TreeSeries();
    series.add(item);
    chart.getConfiguration().addSeries(series);
    HasItem hasItem = new HasItemTestImpl(chart, 0, 0);
    hasItem.getItem();
}
Also used : TreeSeries(com.vaadin.flow.component.charts.model.TreeSeries) HasItem(com.vaadin.flow.component.charts.events.HasItem) TreeSeriesItem(com.vaadin.flow.component.charts.model.TreeSeriesItem) Test(org.junit.Test)

Aggregations

HasItem (com.vaadin.flow.component.charts.events.HasItem)5 Test (org.junit.Test)5 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)2 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)2 NodeSeries (com.vaadin.flow.component.charts.model.NodeSeries)2 TreeSeries (com.vaadin.flow.component.charts.model.TreeSeries)2 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)1 Node (com.vaadin.flow.component.charts.model.Node)1 Series (com.vaadin.flow.component.charts.model.Series)1 TreeSeriesItem (com.vaadin.flow.component.charts.model.TreeSeriesItem)1