use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WPanelRenderer_Test method testRenderAllPanelTypes.
@Test
public void testRenderAllPanelTypes() throws IOException, SAXException, XpathException {
// Tests that all panel types are schema valid
for (WPanel.Type type : WPanel.Type.values()) {
WPanel panel = new WPanel(type);
WButton button = new WButton("submit");
panel.add(button);
panel.setDefaultSubmitButton(button);
panel.setTitleText("Panel title");
assertSchemaMatch(panel);
}
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintTableActionsInvisibleButton.
@Test
public void testDoPaintTableActionsInvisibleButton() throws IOException, SAXException, XpathException {
WTable component = new WTable();
component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
TableModel tableModel = createTableModel();
component.setTableModel(tableModel);
component.setVisible(true);
WButton button1 = new WButton(TEST_ACTION_ONE);
component.addAction(button1);
// Visible
assertXpathExists("//ui:table/ui:actions", component);
// Not Visible
button1.setVisible(false);
assertXpathNotExists("//ui:table/ui:actions", component);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintTableActions.
@Test
public void testDoPaintTableActions() throws IOException, SAXException, XpathException {
WTable component = new WTable();
component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
TableModel tableModel = createTableModel();
component.setTableModel(tableModel);
component.setVisible(true);
component.addAction(new WButton(TEST_ACTION_ONE));
component.addAction(new WButton(TEST_ACTION_TWO));
assertXpathExists("//ui:table/ui:actions", component);
assertXpathEvaluatesTo(TEST_ACTION_ONE, "//ui:table/ui:actions/ui:action[1]/html:button", component);
assertXpathEvaluatesTo(TEST_ACTION_TWO, "//ui:table/ui:actions/ui:action[2]/html:button", component);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WTextAreaRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WTextArea field = new WTextArea();
WButton button = new WButton();
WContainer root = new WContainer();
root.add(field);
root.add(button);
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getId(), "//ui:textarea/@id", field);
assertXpathNotExists("//ui:textarea/@disabled", field);
assertXpathNotExists("//ui:textarea/@hidden", field);
assertXpathNotExists("//ui:textarea/@required", field);
assertXpathNotExists("//ui:textarea/@readOnly", field);
assertXpathNotExists("//ui:textarea/@minLength", field);
assertXpathNotExists("//ui:textarea/@maxLength", field);
assertXpathNotExists("//ui:textarea/@toolTip", field);
assertXpathNotExists("//ui:textarea/@accessibleText", field);
assertXpathNotExists("//ui:textarea/@rows", field);
assertXpathNotExists("//ui:textarea/@cols", field);
assertXpathNotExists("//ui:textarea/ui:rtf", field);
field.setDisabled(true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:textarea/@disabled", field);
setFlag(field, ComponentModel.HIDE_FLAG, true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:textarea/@hidden", field);
field.setMandatory(true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:textarea/@required", field);
field.setMinLength(45);
assertSchemaMatch(field);
assertXpathEvaluatesTo("45", "//ui:textarea/@minLength", field);
field.setMaxLength(50);
assertSchemaMatch(field);
assertXpathEvaluatesTo("50", "//ui:textarea/@maxLength", field);
field.setToolTip("tooltip");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getToolTip(), "//ui:textarea/@toolTip", field);
field.setAccessibleText("accessible");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getAccessibleText(), "//ui:textarea/@accessibleText", field);
field.setRows(20);
assertSchemaMatch(field);
assertXpathEvaluatesTo("20", "//ui:textarea/@rows", field);
field.setColumns(40);
assertSchemaMatch(field);
assertXpathEvaluatesTo("40", "//ui:textarea/@cols", field);
field.setRichTextArea(false);
assertSchemaMatch(field);
assertXpathNotExists("//ui:textarea/ui:rtf", field);
field.setRichTextArea(true);
assertSchemaMatch(field);
assertXpathExists("//ui:textarea/ui:rtf", field);
field.setDefaultSubmitButton(button);
assertSchemaMatch(field);
assertXpathEvaluatesTo(button.getId(), "//ui:textarea/@buttonId", field);
field.setPattern("");
assertSchemaMatch(field);
assertXpathNotExists("//ui:textarea/@pattern", field);
// Pattern is not supported on the client for TextArea, and will not be rendered
field.setPattern("test[123]");
assertSchemaMatch(field);
assertXpathNotExists("//ui:textarea/@pattern", field);
field.setText("Hello");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getText(), "normalize-space(//ui:textarea)", field);
field.setPlaceholder("enter stuff here");
assertSchemaMatch(field);
assertXpathEvaluatesTo("enter stuff here", "//ui:textarea/@placeholder", field);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WToggleButtonRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WToggleButton toggle = new WToggleButton();
WComponentGroup<WToggleButton> group = new WComponentGroup<>();
WButton button = new WButton("test");
WContainer root = new WContainer();
root.add(toggle);
root.add(group);
root.add(button);
setActiveContext(createUIContext());
assertSchemaMatch(toggle);
assertXpathExists("//ui:togglebutton", toggle);
assertXpathEvaluatesTo(toggle.getId(), "//ui:togglebutton/@id", toggle);
// Check disabled
assertXpathNotExists("//ui:togglebutton/@disabled", toggle);
toggle.setDisabled(true);
assertSchemaMatch(toggle);
assertXpathEvaluatesTo("true", "//ui:togglebutton/@disabled", toggle);
// Check hidden
assertXpathNotExists("//ui:togglebutton/@hidden", toggle);
setFlag(toggle, ComponentModel.HIDE_FLAG, true);
assertSchemaMatch(toggle);
assertXpathEvaluatesTo("true", "//ui:togglebutton/@hidden", toggle);
// Check selected
assertXpathNotExists("//ui:togglebutton/@selected", toggle);
toggle.setSelected(true);
assertSchemaMatch(toggle);
assertXpathEvaluatesTo("true", "//ui:togglebutton/@selected", toggle);
// Check toolTip
assertXpathNotExists("//ui:togglebutton/@toolTip", toggle);
toggle.setToolTip("WCheckBox_Test.testRenderedFormat.title");
assertSchemaMatch(toggle);
assertXpathEvaluatesTo(toggle.getToolTip(), "//ui:togglebutton/@toolTip", toggle);
// Check accessibleText
assertXpathNotExists("//ui:togglebutton/@accessibleText", toggle);
toggle.setAccessibleText("WCheckBox_Test.testRenderedFormat.accessibleText");
assertSchemaMatch(toggle);
assertXpathEvaluatesTo(toggle.getAccessibleText(), "//ui:togglebutton/@accessibleText", toggle);
}
Aggregations