예제 #1
0
        public void Output_button_input_when_button_with_no_content_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(null, null, null, "value", null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #2
0
        public void Output_message_paragraph()
        {
            var t = new DefaultFormTemplate();

            var result = t.MessageParagraph(new HtmlString("<strong>asdf</strong>"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #3
0
        public void Output_begin_navigation()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginNavigation();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #4
0
        public void Begin_form_with_enctype()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginForm("/", FormMethod.Post, new HtmlAttributes(data_attr => "value"), EncType.Multipart);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void End_section()
        {
            var t = new DefaultFormTemplate();

            var result = t.EndSection();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #6
0
        public void Output_begin_information_message_without_heading()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginMessage(MessageType.Information, new HtmlString(""));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Begin_form_with_enctype()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginForm("/", FormMethod.Post, new HtmlAttributes(data_attr => "value"), EncType.Multipart);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #8
0
        public void Output_begin_failure_message()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginMessage(MessageType.Failure, new HtmlString("Heading"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #9
0
        public void Begin_nested_section_without_leading_html_or_heading()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginNestedSection();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #10
0
        public void End_form()
        {
            var t = new DefaultFormTemplate();

            var result = t.EndForm();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #11
0
        public void Begin_nested_section()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginNestedSection(new HtmlString("Section Heading"), new HtmlString("<p>Hello</p>"), new { @class = "asdf" }.ToHtmlAttributes());

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #12
0
        public void End_nested_section()
        {
            var t = new DefaultFormTemplate();

            var result = t.EndNestedSection();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Allow_for_name_to_be_specified_but_id_to_be_overwritten_when_creating_a_button()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("a"), null, "name", null, new HtmlAttributes().Attr("id", "asdf"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Begin_form_without_enctype()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginForm("/", FormMethod.Post, null, null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #15
0
        public void Allow_for_name_to_be_specified_but_id_to_be_overwritten_when_creating_a_button()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("a"), null, "name", null, new HtmlAttributes().Attr("id", "asdf"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #16
0
        public void Output_end_message()
        {
            var t = new DefaultFormTemplate();

            var result = t.EndMessage();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #17
0
        public void Throw_exception_when_nothing_for_user_to_see()
        {
            var t = new DefaultFormTemplate();

            var e = Assert.Throws <ArgumentNullException>(() => t.Button(null, "type", "id", null, new HtmlAttributes(@class => "asdf")));

            Assert.That(e.ParamName, Is.EqualTo("content"));
        }
        public void Begin_section()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginSection(new HtmlString("Section Heading"), new HtmlString("<p>hello</p>"), new { @class = "asdf" }.ToHtmlAttributes());

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #19
0
        public void Output_submit_button_when_button_with_content_and_submit_type_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("<strong>asdf</strong>"), "submit", "id", "value", new HtmlAttributes(@class => "asdf"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Begin_nested_section_without_leading_html_or_heading()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginNestedSection();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #21
0
        public void Output_button_when_button_with_content_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("<strong>asdf</strong>"), null, null, null, null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #22
0
        public void Output_field_with_hint_id()
        {
            var t = new DefaultFormTemplate();

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration().WithHint("hello").WithHintId("HintId"), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #23
0
        public void Begin_form_without_enctype()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginForm("/", FormMethod.Post, null, null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #24
0
        public void Output_begin_field()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginField(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration(), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #25
0
        public void Output_field_with_container_class()
        {
            var t = new DefaultFormTemplate();

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration().AddFieldContainerClass("a-container-class-1").AddFieldContainerClass("a-container-class-2"), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
예제 #26
0
        public void Construct_form_via_extension_method()
        {
            var t = new DefaultFormTemplate();

            var f2 = _h.BeginChameleonForm(Action, Method, new HtmlAttributes(), Enctype);

            Assert.That(f2, Is.Not.Null);
            _h.ViewContext.Writer.Received().Write(Arg.Is <IHtmlString>(h => h.ToHtmlString() == t.BeginForm(Action, Method, _htmlAttributes, Enctype).ToHtmlString()));
        }
예제 #27
0
        public TestFieldGenerator(MvcTestContext context)
        {
            var viewContext = context.GetViewTestContext <TModel>();

            HtmlHelper    = viewContext.HtmlHelper;
            FieldProperty = null;
            Template      = new DefaultFormTemplate();
            Metadata      = new EmptyModelMetadataProvider().GetMetadataForType(typeof(T));
        }
예제 #28
0
        public void Output_field_with_prepended_and_appended_html()
        {
            var t = new DefaultFormTemplate();

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

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_field_with_container_class()
        {
            var t = new DefaultFormTemplate();

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration().AddFieldContainerClass("a-container-class-1").AddFieldContainerClass("a-container-class-2"), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_field_with_hint()
        {
            var t = new DefaultFormTemplate();

            var result = t.Field(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration().WithHint("hello"), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_field_with_prepended_and_appended_html()
        {
            var t = new DefaultFormTemplate();

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

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_begin_field()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginField(new HtmlString("labelhtml"), new HtmlString("elementhtml"), new HtmlString("validationhtml"), null, new FieldConfiguration(), false);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_begin_navigation()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginNavigation();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_begin_information_message_without_heading()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginMessage(MessageType.Information, new HtmlString(""));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_begin_failure_message()
        {
            var t = new DefaultFormTemplate();

            var result = t.BeginMessage(MessageType.Failure, new HtmlString("Heading"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_end_message()
        {
            var t = new DefaultFormTemplate();

            var result = t.EndMessage();

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_message_paragraph()
        {
            var t = new DefaultFormTemplate();

            var result = t.MessageParagraph(new HtmlString("<strong>asdf</strong>"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_button_input_when_button_with_no_content_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(null, null, null, "value", null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_button_when_button_with_content_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("<strong>asdf</strong>"), null, null, null, null);

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Output_submit_button_when_button_with_content_and_submit_type_specified()
        {
            var t = new DefaultFormTemplate();

            var result = t.Button(new HtmlString("<strong>asdf</strong>"), "submit", "id", "value", new HtmlAttributes(@class => "asdf"));

            HtmlApprovals.VerifyHtml(result.ToHtmlString());
        }
        public void Throw_exception_when_nothing_for_user_to_see()
        {
            var t = new DefaultFormTemplate();

            var e = Assert.Throws<ArgumentNullException>(() => t.Button(null, "type", "id", null, new HtmlAttributes(@class => "asdf")));

            Assert.That(e.ParamName, Is.EqualTo("content"));
        }
예제 #42
0
 static FormTemplate()
 {
     Default = new DefaultFormTemplate();
 }