Search in sources :

Example 21 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WListRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WList list = new WList(WList.Type.STRIPED);
    list.setRepeatedComponent(new WText());
    assertXpathNotExists("//ui:panel/ui:margin", list);
    Margin margin = new Margin(0);
    list.setMargin(margin);
    assertXpathNotExists("//ui:panel/ui:margin", list);
    margin = new Margin(Size.SMALL);
    list.setMargin(margin);
    assertSchemaMatch(list);
    assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@all", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@north", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@east", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@south", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@west", list);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    list.setMargin(margin);
    assertSchemaMatch(list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@all", list);
    assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@north", list);
    assertXpathEvaluatesTo("med", "//ui:panel/ui:margin/@east", list);
    assertXpathEvaluatesTo("lg", "//ui:panel/ui:margin/@south", list);
    assertXpathEvaluatesTo("xl", "//ui:panel/ui:margin/@west", list);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 22 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WRowRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WRow row = new WRow();
    row.add(new WColumn(100));
    assertXpathNotExists("//ui:row/ui:margin", row);
    Margin margin = new Margin(0);
    row.setMargin(margin);
    assertXpathNotExists("//ui:row/ui:margin", row);
    margin = new Margin(GAP);
    row.setMargin(margin);
    assertSchemaMatch(row);
    assertXpathEvaluatesTo(GAP.toString(), "//ui:row/ui:margin/@all", row);
    assertXpathEvaluatesTo("", "//ui:row/ui:margin/@north", row);
    assertXpathEvaluatesTo("", "//ui:row/ui:margin/@east", row);
    assertXpathEvaluatesTo("", "//ui:row/ui:margin/@south", row);
    assertXpathEvaluatesTo("", "//ui:row/ui:margin/@west", row);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    row.setMargin(margin);
    assertSchemaMatch(row);
    assertXpathEvaluatesTo("", "//ui:row/ui:margin/@all", row);
    assertXpathEvaluatesTo(Size.SMALL.toString(), "//ui:row/ui:margin/@north", row);
    assertXpathEvaluatesTo(Size.MEDIUM.toString(), "//ui:row/ui:margin/@east", row);
    assertXpathEvaluatesTo(Size.LARGE.toString(), "//ui:row/ui:margin/@south", row);
    assertXpathEvaluatesTo(Size.XL.toString(), "//ui:row/ui:margin/@west", row);
}
Also used : WRow(com.github.bordertech.wcomponents.WRow) WColumn(com.github.bordertech.wcomponents.WColumn) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 23 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WSectionRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WSection section = new WSection("");
    assertXpathNotExists("//ui:section/ui:margin", section);
    Margin margin = new Margin(0);
    section.setMargin(margin);
    assertXpathNotExists("//ui:section/ui:margin", section);
    margin = new Margin(Size.SMALL);
    section.setMargin(margin);
    assertSchemaMatch(section);
    assertXpathEvaluatesTo("sm", "//ui:section/ui:margin/@all", section);
    assertXpathEvaluatesTo("", "//ui:section/ui:margin/@north", section);
    assertXpathEvaluatesTo("", "//ui:section/ui:margin/@east", section);
    assertXpathEvaluatesTo("", "//ui:section/ui:margin/@south", section);
    assertXpathEvaluatesTo("", "//ui:section/ui:margin/@west", section);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    section.setMargin(margin);
    assertSchemaMatch(section);
    assertXpathEvaluatesTo("", "//ui:section/ui:margin/@all", section);
    assertXpathEvaluatesTo("sm", "//ui:section/ui:margin/@north", section);
    assertXpathEvaluatesTo("med", "//ui:section/ui:margin/@east", section);
    assertXpathEvaluatesTo("lg", "//ui:section/ui:margin/@south", section);
    assertXpathEvaluatesTo("xl", "//ui:section/ui:margin/@west", section);
}
Also used : WSection(com.github.bordertech.wcomponents.WSection) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 24 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WCollapsibleRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.EAGER);
    assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
    Margin margin = new Margin(0);
    collapsible.setMargin(margin);
    assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
    margin = new Margin(Size.SMALL);
    collapsible.setMargin(margin);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@all", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@north", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@east", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@south", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@west", collapsible);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    collapsible.setMargin(margin);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@all", collapsible);
    assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@north", collapsible);
    assertXpathEvaluatesTo("med", "//ui:collapsible/ui:margin/@east", collapsible);
    assertXpathEvaluatesTo("lg", "//ui:collapsible/ui:margin/@south", collapsible);
    assertXpathEvaluatesTo("xl", "//ui:collapsible/ui:margin/@west", collapsible);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 25 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WDefinitionListRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WDefinitionList section = new WDefinitionList();
    assertXpathNotExists("//ui:definitionlist/ui:margin", section);
    Margin margin = new Margin(0);
    section.setMargin(margin);
    assertXpathNotExists("//ui:definitionlist/ui:margin", section);
    margin = new Margin(Size.SMALL);
    section.setMargin(margin);
    assertSchemaMatch(section);
    assertXpathEvaluatesTo("sm", "//ui:definitionlist/ui:margin/@all", section);
    assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@north", section);
    assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@east", section);
    assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@south", section);
    assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@west", section);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    section.setMargin(margin);
    assertSchemaMatch(section);
    assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@all", section);
    assertXpathEvaluatesTo("sm", "//ui:definitionlist/ui:margin/@north", section);
    assertXpathEvaluatesTo("med", "//ui:definitionlist/ui:margin/@east", section);
    assertXpathEvaluatesTo("lg", "//ui:definitionlist/ui:margin/@south", section);
    assertXpathEvaluatesTo("xl", "//ui:definitionlist/ui:margin/@west", section);
}
Also used : WDefinitionList(com.github.bordertech.wcomponents.WDefinitionList) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Aggregations

Margin (com.github.bordertech.wcomponents.Margin)25 Test (org.junit.Test)13 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)10 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)6 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)4 WHeading (com.github.bordertech.wcomponents.WHeading)4 WText (com.github.bordertech.wcomponents.WText)4 WTextField (com.github.bordertech.wcomponents.WTextField)4 Action (com.github.bordertech.wcomponents.Action)3 WButton (com.github.bordertech.wcomponents.WButton)3 WPanel (com.github.bordertech.wcomponents.WPanel)3 WLabel (com.github.bordertech.wcomponents.WLabel)2 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)2 FlowLayout (com.github.bordertech.wcomponents.layout.FlowLayout)2 Disable (com.github.bordertech.wcomponents.subordinate.Disable)2 Enable (com.github.bordertech.wcomponents.subordinate.Enable)2 Equal (com.github.bordertech.wcomponents.subordinate.Equal)2 Rule (com.github.bordertech.wcomponents.subordinate.Rule)2 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)2