public void Decorate(IHtmlNode td)
 {
     if (rowSpan > 1)
     {
         td.Attribute("rowSpan", rowSpan.ToString());
     }
     if (dataIndex > -1)
     {
         td.Attribute("data-index", dataIndex.ToString(), true);
     }
 }
Beispiel #2
0
        public IHtmlNode ChildrenTag(PanelBarItem item)
        {
            IHtmlNode ul = ListTag();

            if (!item.Enabled)
            {
                ul.Attribute("style", "display:none");
            }
            else if (item.Enabled && !item.Expanded)
            {
                ul.Attribute("style", "display:none");
            }

            return(ul);
        }
Beispiel #3
0
        public void Build_should_call_InnerContentMethod_and_append_to_wrapper()
        {
            IHtmlNode tag = renderer.Build().Children[0];

            Assert.Equal("div", tag.TagName);
            Assert.True(tag.Attribute("class").Contains("t-dropdown-wrap"));
        }
        public void Build_should_render_tag_with_widget_and_timepicker_classes()
        {
            IHtmlNode tag = renderer.Build();

            Assert.Equal("div", tag.TagName);
            Assert.Equal(UIPrimitives.Widget + " t-timepicker", tag.Attribute("class"));
        }
        public void Button_should_render_span_tag_with_select_class()
        {
            IHtmlNode tag = renderer.ButtonTag();

            Assert.Equal("t-select", tag.Attribute("class"));
            Assert.Equal("span", tag.TagName);
        }
Beispiel #6
0
        public void Should_output_child_ul()
        {
            IHtmlNode tag = renderer.ChildrenTag(item);

            Assert.Equal("ul", tag.TagName);
            Assert.Equal("t-group", tag.Attribute("class"));
        }
Beispiel #7
0
        public void Input_should_render_input_control()
        {
            IHtmlNode tag = renderer.InputTag();

            Assert.Contains(UIPrimitives.Input, tag.Attribute("class"));
            Assert.Equal("input", tag.TagName);
        }
        public void Should_append_custom_class()
        {
            item.HtmlAttributes["class"] = "custom";
            IHtmlNode node = renderer.ItemTag(item);

            Assert.Equal("t-item t-state-default custom", node.Attribute("class"));
        }
Beispiel #9
0
        public void Should_append_custom_class()
        {
            item.HtmlAttributes["class"] = "custom";
            IHtmlNode node = renderer.ItemTag(item, false);

            Assert.Equal("t-item t-first t-last custom", node.Attribute("class"));
        }
        public void ItemStart_should_render_ul_start_tag_and_class()
        {
            IHtmlNode tag = builder.TabStripTag().Children[0];

            Assert.Equal("ul", tag.TagName);
            Assert.Contains(UIPrimitives.ResetStyle, tag.Attribute("class"));
        }
        public void Should_apply_disabled_state()
        {
            item.Enabled = false;
            IHtmlNode tag = builder.ItemTag(item);

            Assert.Equal("t-item t-state-disabled", tag.Attribute("class"));
        }
Beispiel #12
0
        public void TreeViewStart_should_render_ul_start_tag_and_class()
        {
            IHtmlNode tag = renderer.TreeViewTag().Children[0];

            Assert.Equal("ul", tag.TagName);
            Assert.Equal("t-group t-treeview-lines", tag.Attribute("class"));
        }
Beispiel #13
0
        public void Should_append_last_class_if_last_item()
        {
            item.Parent = new TreeViewItem();
            IHtmlNode node = renderer.ItemTag(item, false);

            Assert.Equal("t-item t-last", node.Attribute("class"));
        }
        public void Should_apply_default_state()
        {
            item.Enabled = true;
            IHtmlNode tag = builder.ItemTag(item);

            Assert.Equal("t-item t-state-default", tag.Attribute("class"));
        }
        public void Should_render_Link_start_tag_with_Link_class()
        {
            IHtmlNode tag = builder.ItemInnerTag(item);

            Assert.Equal("span", tag.TagName);
            Assert.Equal(UIPrimitives.Link, tag.Attribute("class"));
        }
        public void Should_render_DefaultState_class_if_the_item_enabled_and_not_active()
        {
            item.HtmlAttributes.Clear();

            IHtmlNode tag = builder.ItemTag(item);

            Assert.Contains(UIPrimitives.DefaultState, tag.Attribute("class"));
        }
        public void Should_render_Item_class()
        {
            item.HtmlAttributes.Clear();

            IHtmlNode tag = builder.ItemTag(item);

            Assert.Contains(UIPrimitives.Item, tag.Attribute("class"));
        }
        public void CreateUpload_should_not_render_accept_attribute()
        {
            upload.HtmlAttributes.Add("accept", "FOO");

            IHtmlNode tag = builder.CreateUpload();

            Assert.Throws <System.Collections.Generic.KeyNotFoundException>(() => tag.Attribute("accept"));
        }
Beispiel #19
0
        public void Build_should_output_render_css_classes()
        {
            const string css = "t-widget t-dropdown t-header";

            IHtmlNode tag = renderer.Build();

            Assert.Equal(css, tag.Attribute("class"));
        }
        public void CreateUpload_should_set_CSS_classes()
        {
            const string css = "t-widget t-upload";

            IHtmlNode tag = builder.CreateUpload();

            tag.Attribute("class").ShouldEqual(css);
        }
        public void Should_apply_vertical_css_class()
        {
            menu.Orientation = MenuOrientation.Vertical;

            IHtmlNode tag = builder.Build();

            Assert.Equal("t-widget t-reset t-header t-menu t-menu-vertical", tag.Attribute("class"));
        }
        public void Should_apply_selected_state()
        {
            item.Enabled  = true;
            item.Selected = true;
            IHtmlNode tag = builder.ItemTag(item);

            Assert.Equal("t-item t-state-selected", tag.Attribute("class"));
        }
Beispiel #23
0
        public void Input_should_render_html_attributes()
        {
            dateTimePicker.InputHtmlAttributes.Add("class", "t-test");

            IHtmlNode tag = renderer.InputTag();

            Assert.Equal(UIPrimitives.Input + " t-test", tag.Attribute("class"));
        }
Beispiel #24
0
        public void Build_should_render_html_attributes()
        {
            dropDownList.HtmlAttributes.Add("title", "genericInput");

            IHtmlNode tag = renderer.Build();

            Assert.Equal("genericInput", tag.Attribute("title"));
        }
        public void Render_should_output_custom_menu_css_class_when_set()
        {
            menu.HtmlAttributes.Add("class", "custom");

            IHtmlNode tag = builder.Build();

            Assert.Equal("t-widget t-reset t-header t-menu custom", tag.Attribute("class"));
        }
        public void CreateUpload_should_render_html_attributes()
        {
            upload.HtmlAttributes.Add("title", "genericUpload");

            IHtmlNode tag = builder.CreateUpload();

            tag.Attribute("title").ShouldEqual("genericUpload");
        }
Beispiel #27
0
        public void HiddenInputTag_should_set_auto_name_if_not_set()
        {
            combobox.Name = "test";

            IHtmlNode tag = renderer.HiddenInputTag();

            tag.Attribute("name").ShouldEqual(combobox.Name);
        }
Beispiel #28
0
        public void Build_should_output_html_attributes()
        {
            combobox.HtmlAttributes.Add("height", "100px");

            IHtmlNode tag = renderer.Build();

            Assert.Equal("100px", tag.Attribute("height"));
        }
Beispiel #29
0
        public void HiddenInputTag_should_set_id_from_inputHtmlAttr()
        {
            combobox.HiddenInputHtmlAttributes.Add("id", "test");

            IHtmlNode tag = renderer.HiddenInputTag();

            tag.Attribute("id").ShouldEqual("test");
        }
Beispiel #30
0
        public void HiddenInputTag_should_output_html_attributes()
        {
            combobox.HiddenInputHtmlAttributes.Add("height", "100px");

            IHtmlNode tag = renderer.HiddenInputTag();

            Assert.Equal("100px", tag.Attribute("height"));
        }
Beispiel #31
0
        public void Build_should_output_combobox_css_class_and_append_custom_css_classes()
        {
            combobox.HtmlAttributes.Add("class", "myClass");

            IHtmlNode tag = renderer.Build();

            Assert.Equal("t-widget t-combobox t-header myClass", tag.Attribute("class"));
        }
        protected virtual void AddEventAttributes(IHtmlNode html, IDictionary<string, object> events)
        {
            foreach (var keyValuePair in events)
            {
                var value = keyValuePair.Value as ClientHandlerDescriptor;
                var key = "data-" + keyValuePair.Key;

                if (value.HandlerName.HasValue())
                {
                    html.Attribute(key, value.HandlerName);
                }

            }
        }
Beispiel #33
0
        protected virtual void AddAttributes(IHtmlNode link)
        {
            if (Url.HasValue())
            {
                link.Attribute("href", Url);
            }

            if (Target.HasValue())
            {
                link.Attribute("data-target", Target);
            }

            if (Rel != MobileButtonRel.None)
            {
                link.Attribute("data-rel", Rel.ToString().ToLower());

                if (Rel == MobileButtonRel.ActionSheet)
                {
                    link.Attribute("data-actionsheet-context", ActionsheetContext);
                }
            }

            link.Attributes(LinkHtmlAttributes);
        }
 protected override void ApplyButtonAttributes(IHtmlNode button, object dataItem)
 {
     button.Attribute("href", Url(dataItem));
 }
Beispiel #35
0
        private void SerializeViews(IHtmlNode html, string[] views, string attr)
        {
            if (views == null || views.Length == 0)
                return;

            var output = new StringBuilder();

            output.Append("[");

            foreach (var view in views)
            {
                output.Append("\"");
                output.Append(HttpUtility.HtmlAttributeEncode(view));
                output.Append("\",");
            }

            output.Remove(output.Length - 1, 1);

            output.Append("]");

            html.Attribute(attr, output.ToString());
        }
Beispiel #36
0
        private void SerializeViews(IHtmlNode html)
        {
            if (component.Views.Length == 0)
                return;

            var output = new StringBuilder();

            output.Append("[");

            foreach (var view in component.Views)
            {
                output.Append("\"");
                output.Append(HttpUtility.HtmlAttributeEncode(view));
                output.Append("\",");
            }

            output.Remove(output.Length - 1, 1);

            output.Append("]");

            html.Attribute("data-views", output.ToString());
        }
 protected override void ApplyButtonAttributes(IHtmlNode button, object dataItem)
 {
     button.Attribute("type", "submit");
 }