use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintTableActions.
@Test
public void testDoPaintTableActions() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
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));
TableDataModel tableModel = createTableModel();
component.setDataModel(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 WDateFieldRenderer_Test method testDoPaintAllOptions.
@Test
public void testDoPaintAllOptions() throws IOException, SAXException, XpathException {
WButton button = new WButton();
WDateField dateField = new WDateField();
dateField.setDate(TEST_DATE);
dateField.setDisabled(true);
setFlag(dateField, ComponentModel.HIDE_FLAG, true);
dateField.setMandatory(true);
dateField.setToolTip("TITLE");
dateField.setAccessibleText("ALT");
dateField.setDefaultSubmitButton(button);
dateField.setMinDate(DateUtilities.createDate(01, 02, 2011));
dateField.setMaxDate(DateUtilities.createDate(02, 03, 2012));
setActiveContext(createUIContext());
// Validate Schema
assertSchemaMatch(dateField);
// Check Attributes
assertXpathEvaluatesTo(dateField.getId(), "//ui:datefield/@id", dateField);
// Optional
assertXpathEvaluatesTo(TEST_INTERNAL_DATE_STRING, "//ui:datefield/@date", dateField);
assertXpathEvaluatesTo("true", "//ui:datefield/@disabled", dateField);
assertXpathEvaluatesTo("true", "//ui:datefield/@hidden", dateField);
assertXpathEvaluatesTo("true", "//ui:datefield/@required", dateField);
assertXpathEvaluatesTo("TITLE", "//ui:datefield/@toolTip", dateField);
assertXpathEvaluatesTo("ALT", "//ui:datefield/@accessibleText", dateField);
assertXpathEvaluatesTo(button.getId(), "//ui:datefield/@buttonId", dateField);
assertXpathEvaluatesTo("2011-02-01", "//ui:datefield/@min", dateField);
assertXpathEvaluatesTo("2012-03-02", "//ui:datefield/@max", dateField);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WDialogRenderer_Test method testRenderTrigger.
@Test
public void testRenderTrigger() throws IOException, SAXException, XpathException {
WButton trigger = new WButton("Launch dialog");
WButton content = new WButton("Dialog content");
WDialog dialog = new WDialog(content, trigger);
assertXpathExists("//ui:dialog", dialog);
assertXpathEvaluatesTo(dialog.getId(), "//ui:dialog/@id", dialog);
assertXpathNotExists("//ui:dialog/@open", dialog);
assertXpathEvaluatesTo(trigger.getId(), "//ui:dialog/html:button/@id", dialog);
assertXpathEvaluatesTo(trigger.getId(), "//ui:dialog/@triggerid", dialog);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class WEmailFieldRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WEmailField field = new WEmailField();
WButton button = new WButton();
WSuggestions suggestions = new WSuggestions();
WContainer root = new WContainer();
root.add(field);
root.add(button);
root.add(suggestions);
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getId(), "//ui:emailfield/@id", field);
assertXpathNotExists("//ui:emailfield/@disabled", field);
assertXpathNotExists("//ui:emailfield/@hidden", field);
assertXpathNotExists("//ui:emailfield/@required", field);
assertXpathNotExists("//ui:emailfield/@readOnly", field);
assertXpathNotExists("//ui:emailfield/@maxLength", field);
assertXpathNotExists("//ui:emailfield/@toolTip", field);
assertXpathNotExists("//ui:emailfield/@accessibleText", field);
assertXpathNotExists("//ui:emailfield/@size", field);
assertXpathNotExists("//ui:emailfield/@buttonId", field);
assertXpathNotExists("//ui:emailfield/@list", field);
field.setDisabled(true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:emailfield/@disabled", field);
setFlag(field, ComponentModel.HIDE_FLAG, true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:emailfield/@hidden", field);
field.setMandatory(true);
assertSchemaMatch(field);
assertXpathEvaluatesTo("true", "//ui:emailfield/@required", field);
field.setMaxLength(50);
assertSchemaMatch(field);
assertXpathEvaluatesTo("50", "//ui:emailfield/@maxLength", field);
field.setToolTip("tooltip");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getToolTip(), "//ui:emailfield/@toolTip", field);
field.setAccessibleText("accessible");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getAccessibleText(), "//ui:emailfield/@accessibleText", field);
field.setColumns(40);
assertSchemaMatch(field);
assertXpathEvaluatesTo("40", "//ui:emailfield/@size", field);
field.setDefaultSubmitButton(button);
assertSchemaMatch(field);
assertXpathEvaluatesTo(button.getId(), "//ui:emailfield/@buttonId", field);
// RFC 2606
field.setText("nobody@wc.test");
assertSchemaMatch(field);
assertXpathEvaluatesTo(field.getText(), "normalize-space(//ui:emailfield)", field);
field.setSuggestions(suggestions);
assertSchemaMatch(field);
assertXpathEvaluatesTo(suggestions.getId(), "//ui:emailfield/@list", field);
field.setPlaceholder("enter stuff here");
assertSchemaMatch(field);
assertXpathEvaluatesTo("enter stuff here", "//ui:emailfield/@placeholder", field);
}
use of com.github.bordertech.wcomponents.WButton in project wcomponents by BorderTech.
the class UicStats_Test method setUp.
@Before
public void setUp() {
UIContext uic;
uic = new UIContextImpl();
setActiveContext(uic);
app = new WApplication();
button = new WButton("PUSH");
app.add(button);
label = new WLabel("HERE");
app.add(label);
uic.setUI(app);
stats = new UicStats(uic);
}
Aggregations