public void mustache_value()
        {
            var tag = new TextboxTag();
            tag.MustacheValue("prop");

            tag.ToString().ShouldEqual("<input type=\"text\" value=\"{{prop}}\" />");
        }
        public HtmlTag Build(ElementRequest request)
        {
            if (_url.IsEmpty())
            {
                _url = request.Get<IUrlRegistry>().UrlFor(_lookupType);
            }

            request.Get<IAssetRequirements>().Require("fubu.autocomplete.js");

            var label = request.Get<IDisplayFormatter>().GetDisplayForValue(request.Accessor, request.RawValue);
            var hidden = new HiddenTag()
                .Id(request.ElementId)
                .Name(request.ElementId)
                .AddClass("lookup")
                .Attr("value", request.RawValue == null ? string.Empty : request.RawValue.ToString());

            var textboxId = "{0}Value".ToFormat(request.ElementId);
            var textbox = new TextboxTag(textboxId, label)
                .Id(textboxId)
                .Data("lookup-url", _url)
                .Data("value-for", request.ElementId)
                .AddClass("autocomplete");

            hidden.After(textbox);
            
            return hidden;
        }
        private void AddDateInput(string id)
        {
            var input = new TextboxTag()
                .Id(id)
                .Attr(HtmlAttributeConstants.Name, id);

            Child(input);
        }
        public void add_element_name_to_textbox()
        {
            var tag = new TextboxTag();
            ElementRequest request = For(x => x.Address.City);
            request.ElementId = "AddressCity";

            DefaultHtmlConventions.AddElementName(request, tag);

            tag.Attr("name").ShouldEqual("AddressCity");
        }
        public void replace_the_label()
        {
            var layout = new DefinitionListLabelAndField();
            var label = new HtmlTag("span").Text("some text");
            layout.LabelTag = label;

            var display = new TextboxTag().Attr("value", "something");
            layout.LabelTag = display;

            layout.LabelTag.ShouldBeTheSameAs(display);
        }
        public void write_to_string()
        {
            var layout = new DefinitionListLabelAndField();
            var label = new HtmlTag("span").Text("some text");
            layout.LabelTag = label;

            var display = new TextboxTag().Attr("value", "something");
            layout.BodyTag = display;

            var html = layout.ToString();

            html.ShouldContain(label.ToString());
            html.ShouldContain(display.ToString());
        }
        public void wrap_body()
        {
            var layout = new DefinitionListLabelAndField();
            var display = new TextboxTag().Attr("value", "something");
            layout.BodyTag = display;

            var wrapper = new HtmlTag("strong");
            layout.WrapBody(wrapper);

            layout.BodyTag.ShouldBeTheSameAs(display);
            wrapper.Children.ShouldHaveTheSameElementsAs(display);

            layout.ToString().ShouldContain(wrapper.ToString());
        }
        public void do_not_overwrite_name_on_textbox_that_already_has_a_name()
        {
            var tag = new TextboxTag();
            tag.Attr("name", "ExistingName");
            var request = For(x => x.Address.City);
            request.ElementId = "AddressCity";

            DefaultHtmlConventions.AddElementName(request, tag);

            tag.Attr("name").ShouldEqual("ExistingName");
        }