public void PostProcess_Test() { _fullCssData = new CssData(); var state = Substitute.For <IProcessingState>(); var css = new StringBuilder(); state.Css.Returns(css); var elemStates = new IElementProcessingState[] { MockElemProcessingStateWithTableContext(), Substitute.For <IElementProcessingState>(), MockElemProcessingStateWithTableContext(), Substitute.For <IElementProcessingState>(), MockElemProcessingStateWithTableContext(), Substitute.For <IElementProcessingState>() }; state.Elements.Returns(elemStates); _instance.PostProcessing(state); var expected = new StringBuilder(); _fullCssData.RenderInto(expected); Assert.AreEqual(TablePlugin.CSS + expected.ToString(), css.ToString()); }
private string GetCss(CssClass obj) { var cssData = new CssData(); obj.Name = "mockcls"; var sb = new StringBuilder(); obj.InsertCss(cssData); cssData.RenderInto(sb); return(sb.ToString()); }
public void PostProcessing(IProcessingState state) { var cssData = new CssData(); foreach (var elemState in state.Elements) { if (elemState.GetContext(out TableContext tc)) { cssData.AddRange(tc.GetCssData()); } } state.Css.Append(CSS); cssData.RenderInto(state.Css); }
public void RenderInto_NoMediaQueryTest() { string expectedCss = @".test {color: blue;font-weigth: light;}p {color: red;font-weigth: bold;}"; var cssData = new CssData(); cssData.AddAttribute("p", "font-weigth", "bold"); cssData.AddAttribute("p", "color", "red"); cssData.AddAttribute(".test", "font-weigth", "light"); cssData.AddAttribute(".test", "color", "blue"); var sb = new StringBuilder(); cssData.RenderInto(sb); var result = sb.ToString().Trim(); Assert.AreEqual(expectedCss, result); }