use of com.vaadin.ui.declarative.DesignContext in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_yAxisWithTitle_theYAxisWithTitleIsInTheElement.
@Test
public void writeConfiguration_yAxisWithTitle_theYAxisWithTitleIsInTheElement() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
AxisTitle title = new AxisTitle("Temperature");
configuration.getyAxis().setTitle(title);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<y-axis><chart-title text=\"Temperature\"></chart-title></y-axis>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.ui.declarative.DesignContext in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_attributeNameHasMultipleWords_theAttributeValueIsAddedToElement.
@Test
public void writeConfiguration_attributeNameHasMultipleWords_theAttributeValueIsAddedToElement() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
configuration.getChart().setMarginLeft(100);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<chart margin-left=\"100\"></chart>", parent.child(0).toString());
}
use of com.vaadin.ui.declarative.DesignContext in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_titleWithStyle_theStyleIsInnerElementOfTitle.
@Test
public void writeConfiguration_titleWithStyle_theStyleIsInnerElementOfTitle() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
configuration.getTitle().getStyle().setTop("12");
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<chart-title><chart-style top=\"12\"></chart-style></chart-title>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.ui.declarative.DesignContext in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_frameFor3D_theFrameElementHasPrefix.
@Test
public void writeConfiguration_frameFor3D_theFrameElementHasPrefix() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
configuration.getChart().getOptions3d().getFrame().getBack().setSize(1);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<chart><options3d><chart-frame><back size=\"1\"></back></chart-frame></options3d></chart>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.ui.declarative.DesignContext in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_formulaNode_theFormulaIsAddedToElementAsAttribute.
@Test
public void writeConfiguration_formulaNode_theFormulaIsAddedToElementAsAttribute() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
configuration.getTooltip().setFormatter("function() {return '' + this.series.name + ' ' + this.x + ': ' + this.y + '°C';}");
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<tooltip formatter=\"function() {return '' + this.series.name + ' ' + this.x + ': ' + this.y + '°C';}\"></tooltip>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
Aggregations