示例#1
0
        public void TextAreaSecureNoAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new TextArea(htmlHelper);
            var builder = new TextAreaBuilder(component);

            builder
                .Name("CreditLimit")
                .Value("1000")
                .Secure("Finance", "Administrator")
                .Placeholder("Credit Limit");


            var html = builder.ToHtmlString();
            html.Should().Be("<textarea class=\"access-denied\" id=\"CreditLimit\" name=\"CreditLimit\" placeholder=\"Credit Limit\" readonly=\"readonly\">1000</textarea>");

        }
示例#2
0
        public void TextAreaSecureAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper("test.user", new[] { "Finance" });

            var component = new TextArea(htmlHelper);
            var builder = new TextAreaBuilder(component);

            builder
                .Name("CreditLimit")
                .Value("1000")
                .Secure("Finance", "Administrator")
                .Placeholder("Credit Limit");


            var html = builder.ToHtmlString();
            html.Should().Be("<textarea id=\"CreditLimit\" name=\"CreditLimit\" placeholder=\"Credit Limit\">1000</textarea>");

        }
示例#3
0
        public void TextAreaHtml()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new TextArea(htmlHelper);
            var builder = new TextAreaBuilder(component);

            builder
                .Name<Contact, string>(c => c.Name)
                .Columns(30)
                .Rows(5)
                .Value("<p>Testing</p>")
                .Placeholder("Name");


            var html = builder.ToHtmlString();
            html.Should().Be("<textarea cols=\"30\" id=\"Name\" name=\"Name\" placeholder=\"Name\" rows=\"5\">&lt;p&gt;Testing&lt;/p&gt;</textarea>");
        }