public void CanSetUntilNext() { var attr = new FormWidthAttribute(); attr.UntilNext = true; Assert.True(attr.UntilNext); }
public void CreateWithColMd4Sm6() { var attr = new FormWidthAttribute("col-md-4 col-sm-6"); Assert.Equal("col-md-4 col-sm-6", attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(6, attr.Small); Assert.Equal(4, attr.Medium); Assert.Equal(0, attr.Large); }
public void CreateWithDummyValue() { var attr = new FormWidthAttribute("some-dummy-value"); Assert.Equal("some-dummy-value", attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(0, attr.Medium); Assert.Equal(0, attr.Large); }
public void CreateWithColMd4AndRemove() { var attr = new FormWidthAttribute("col-md-4"); attr.Medium = 0; Assert.Equal("", attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(0, attr.Medium); Assert.Equal(0, attr.Large); }
public void CreateWithDefaultConstructor() { var attr = new FormWidthAttribute(); Assert.Null(attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(0, attr.Medium); Assert.Equal(0, attr.Large); Assert.False(attr.UntilNext); }
public void CreateWithColMd4ReplaceWith6() { var attr = new FormWidthAttribute("col-md-4"); attr.Medium = 6; Assert.Equal("col-md-6", attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(6, attr.Medium); Assert.Equal(0, attr.Large); }
public void CreateWithEmptyValue() { var attr = new FormWidthAttribute(null); Assert.Null(attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(0, attr.Medium); Assert.Equal(0, attr.Large); Assert.False(attr.UntilNext); }
public void CreateWithDummyValuesAndSetLg6() { var attr = new FormWidthAttribute("col-md-x col-xs-4 some-dummy-value"); attr.Large = 6; Assert.Equal("col-md-x col-xs-4 some-dummy-value col-lg-6", attr.Value); Assert.Equal(4, attr.XSmall); Assert.Equal(0, attr.Small); Assert.Equal(0, attr.Medium); Assert.Equal(6, attr.Large); }
public void CreateWithColMd4Sm6ReplaceWith23() { var attr = new FormWidthAttribute("col-md-4 col-sm-6"); attr.Medium = 2; attr.Small = 3; Assert.Equal("col-md-2 col-sm-3", attr.Value); Assert.Equal(0, attr.XSmall); Assert.Equal(3, attr.Small); Assert.Equal(2, attr.Medium); Assert.Equal(0, attr.Large); }
private void SetFormCssClass(IPropertySource source, PropertyItem item) { var cssClass = source.GetAttribute <FormCssClassAttribute>() ?? formCssClassPrior; if (cssClass != null) { if (!string.IsNullOrEmpty(cssClass.Value)) { if (!string.IsNullOrEmpty(item.FormCssClass)) { item.FormCssClass = " " + cssClass.Value; } else { item.FormCssClass = cssClass.Value; } } formCssClassPrior = cssClass.UntilNext ? cssClass : null; } var width = source.GetAttribute <FormWidthAttribute>() ?? formWidthPrior; if (width != null) { if (!string.IsNullOrEmpty(width.Value)) { if (!string.IsNullOrEmpty(item.FormCssClass)) { item.FormCssClass += " " + width.Value; } else { item.FormCssClass = width.Value; } } if (!width.JustThis) { formWidthPrior = width.UntilNext ? width : null; } } }