public void SetStyle_InvalidNameFail() { var instance = new VNode(); Assert.ThrowsException <ArgumentException>(() => instance.SetStyle("invalid: name", "color")); Assert.ThrowsException <ArgumentException>(() => instance.SetStyle("invalid; name", "color")); }
public void SetStyle_InvalidValueFail() { var instance = new VNode(); Assert.ThrowsException <ArgumentException>(() => instance.SetStyle("color", "invalid: value")); Assert.ThrowsException <ArgumentException>(() => instance.SetStyle("color", "color; red")); }
public void SetStyle_ReplaceTest() { var instance = new VNode(); instance.SetStyle("color", "red"); instance.SetStyle("color", "blue"); Assert.AreEqual(instance.Attributes["style"], "color: blue"); Assert.AreEqual(instance.Style["color"], "blue"); }
public void SetStyle_MultipleTest() { var instance = new VNode(); instance.SetStyle("color", "red"); instance.SetStyle("background", "blue"); Assert.AreEqual( "color: red; background: blue", instance.Attributes["style"] ); Assert.AreEqual(instance.Style["color"], "red"); Assert.AreEqual(instance.Style["background"], "blue"); }
private static void AddPadding(VNode numberingNumber, IParagraphData pData) { var level = pData.LevelXmlElement; if (level.LevelSuffix?.Val?.Value == LevelSuffixValues.Space) { numberingNumber.SetStyle("padding-right", "0.5em"); } else if (level.LevelSuffix?.Val?.Value == LevelSuffixValues.Nothing) { } else { numberingNumber.SetStyle("padding-right", "1.5em"); } }
public void SetStyle_AddTest() { var instance = new VNode(); instance.SetStyle("color", "red"); Assert.AreEqual(instance.Attributes["style"], "color: red"); Assert.AreEqual("red", instance.Style["color"]); }
private static void SetErrorNode(IElementProcessingState state) { var messageNode = new VNode("div", "Error processing table", state.Index); messageNode.VOffsets.Add(new VTextOffset { Index = state.Index, Delta = messageNode.Text.Length }); messageNode.SetStyle("color", "red"); state.AddContent(messageNode); }
public void Clone_Test() { var node1 = new VNode { Index = 0, Length = 100, }; node1.AddClasses("ng-redirect"); node1.SetAttribute("id", "10"); node1.SetStyle("color", "red"); Assert.IsTrue(node1.Equals(node1)); }