Package org.openmrs.module.htmlformentry.widget

Examples of org.openmrs.module.htmlformentry.widget.CheckboxWidget.generateHtml()


   
    @Test
    public void checkboxWidgetShouldProduceHtml() {
        CheckboxWidget cw = new CheckboxWidget();
        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setInitialValue("Something");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setLabel("This is a label");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><label for=\"w1\">This is a label</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
View Full Code Here


    public void checkboxWidgetShouldProduceHtml() {
        CheckboxWidget cw = new CheckboxWidget();
        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setInitialValue("Something");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setLabel("This is a label");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><label for=\"w1\">This is a label</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
   
    @Test
View Full Code Here

        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setInitialValue("Something");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
        cw.setLabel("This is a label");
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" checked=\"true\"/><label for=\"w1\">This is a label</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
   
    @Test
    public void dropdownWidgetShouldProduceHtml() {
        DropdownWidget dw = new DropdownWidget();
View Full Code Here

    @Test
    public void checkboxWidgetShouldProduceHtmlWithToggleSimple() {
    ToggleWidget toggleWidget = new ToggleWidget("hatColors");
    CheckboxWidget cw = new CheckboxWidget("Has a hat?", "true", toggleWidget.getTargetId(), toggleWidget.isToggleDim());
        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" toggleHide=\"hatColors\"/><label for=\"w1\">Has a hat?</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
   
    @Test
    public void checkboxWidgetShouldProduceHtmlWithToggleDim() {
    ToggleWidget toggleWidget = new ToggleWidget("{id: 'hatColors', style: 'dim'}");
View Full Code Here

    @Test
    public void checkboxWidgetShouldProduceHtmlWithToggleDim() {
    ToggleWidget toggleWidget = new ToggleWidget("{id: 'hatColors', style: 'dim'}");
    CheckboxWidget cw = new CheckboxWidget("Has a hat?", "true", toggleWidget.getTargetId(), toggleWidget.isToggleDim());
        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" toggleDim=\"hatColors\"/><label for=\"w1\">Has a hat?</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
   
    @Test
    public void checkboxWidgetShouldProduceHtmlWithToggleHide() {
    ToggleWidget toggleWidget = new ToggleWidget("{id: 'hatColors', style: 'hide'}");
View Full Code Here

    @Test
    public void checkboxWidgetShouldProduceHtmlWithToggleHide() {
    ToggleWidget toggleWidget = new ToggleWidget("{id: 'hatColors', style: 'hide'}");
    CheckboxWidget cw = new CheckboxWidget("Has a hat?", "true", toggleWidget.getTargetId(), toggleWidget.isToggleDim());
        context.registerWidget(cw);
        Assert.assertEquals("<input type=\"checkbox\" id=\"w1\" name=\"w1\" value=\"true\" toggleHide=\"hatColors\"/><label for=\"w1\">Has a hat?</label><input type=\"hidden\" name=\"_w1\"/>", cw.generateHtml(context));
    }
   
  @Test
  public void toggleWidgetShouldParseSimpleAttribute() {
    ToggleWidget toggleWidget = new ToggleWidget("hatColors");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.