public void Merge_ShouldAddNonExistingAttributesToClass() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.IsTrue(target.Attributes.ContainsKey("height")); Assert.AreEqual("100%", target.Attributes["height"].Value); }
public void Merge_ShouldOverrideExistingImportantEntriesIfNewEntryIsImportant() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50% !important"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100% !important"); target.Merge(donator, true); Assert.IsTrue(target.Attributes.ContainsKey("height")); Assert.AreEqual("100%", target.Attributes["height"].Value); }
public void Merge_ShouldNotOverrideExistingEntriesIfNotSpecified() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, false); Assert.IsTrue(target.Attributes.ContainsKey("height")); Assert.AreEqual("50%", target.Attributes["height"].Value); }
public void Merge_ShouldOverrideExistingEntriesIfSpecifiedIgnoringCasing() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["HEight"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("100%", target.Attributes["height"].Value); }
public void Merge_ShouldNotOverrideExistingImportantEntriesIfNewEntryIsNotImportant() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50% !important"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.IsTrue(target.Attributes.ContainsKey("height")); Assert.AreEqual("50%", target.Attributes["height"].Value); }
public void Merge_ShouldOverrideExistingEntriesIfSpecifiedIgnoringCasing() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["HEight"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.IsTrue(target.Attributes.ContainsKey("height")); Assert.AreEqual("100%", target.Attributes["height"].Value); }