Example #1
0
        public void Output_field_with_prepended_and_appended_html_when_allowed_input_group()
        {
            var t = new TwitterBootstrap3FormTemplate();

            var fc = new FieldConfiguration();

            fc.Bag.CanBeInputGroup = true;

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), GetRequiredMetadata(), fc
                                 .Prepend(new HtmlString("<1>"))
                                 .Prepend(new HtmlString("<2>"))
                                 .Append(new HtmlString("<3>"))
                                 .Append(new HtmlString("<4>"))
                                 .WithHint(new HtmlString("<hint>"))
                                 .AsInputGroup(), // This shouldn't take effect since we haven't specified this field can be an input group
                                 false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
Example #2
0
        public void Output_radio_list_field_with_prepended_and_appended_html_when_required()
        {
            var t  = new TwitterBootstrapFormTemplate();
            var fc = new FieldConfiguration();

            fc.Bag.IsRadioOrCheckboxList = true;
            var metadata = new ModelMetadata(new EmptyModelMetadataProvider(), typeof(object), () => null, typeof(object), "");

            metadata.IsRequired = true;

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), metadata, fc
                                 .Prepend(new HtmlString("<1>")).Prepend(new HtmlString("<2>"))
                                 .Append(new HtmlString("<3>")).Append(new HtmlString("<4>"))
                                 .WithHint(new HtmlString("<hint>")),
                                 false
                                 );

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
Example #3
0
        public void Output_radio_list_field_with_prepended_and_appended_html_when_required()
        {
            var t  = new TwitterBootstrap3FormTemplate();
            var fc = new FieldConfiguration();

            fc.Bag.IsRadioOrCheckboxList = true;

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), GetRequiredMetadata(), fc
                                 .Prepend(new HtmlString("<1>"))
                                 .Prepend(new HtmlString("<2>"))
                                 .Append(new HtmlString("<3>"))
                                 .Append(new HtmlString("<4>"))
                                 .WithHint(new HtmlString("<hint>")),
                                 false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
Example #4
0
        public void Output_field_with_prepended_and_appended_html_when_allowed_input_group()
        {
            var t        = new TwitterBootstrapFormTemplate();
            var metadata = new ModelMetadata(new EmptyModelMetadataProvider(), typeof(object), () => null, typeof(object), "");

            metadata.IsRequired = true;
            var fc = new FieldConfiguration();

            fc.Bag.CanBeInputGroup = true;

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), metadata, fc
                                 .Prepend(new HtmlString("<1>")).Prepend(new HtmlString("<2>"))
                                 .Append(new HtmlString("<3>")).Append(new HtmlString("<4>"))
                                 .WithHint(new HtmlString("<hint>"))
                                 .AsInputGroup() // This shouldn't take effect since we haven't specified this field can be an input group
                                 .ToReadonly(),
                                 false
                                 );

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }