Ejemplo n.º 1
0
        public void Output_checkbox_field_with_prepended_and_appended_html_when_required()
        {
            var t = new TwitterBootstrapFormTemplate();
            var fc = new FieldConfiguration();
            fc.Bag.IsCheckboxControl = 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>"))
                .ToReadonly(),
                false
            );

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
Ejemplo n.º 2
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
                false
            );

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
Ejemplo n.º 3
0
        public void Use_correct_html_for_without_inline_label_for_boolean_checkbox()
        {
            var g = Arrange(x => x.RequiredBoolean);

            IFieldConfiguration config = new FieldConfiguration();
            config = config.WithoutInlineLabel();

            var result = g.GetFieldHtml(config);

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