public void GetCssStylesText() { var o = new DeltaInsertOp("f", _styleAttributes); var c = new OpToXmlConverter(o, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(_styleAttributesCss); }
public void GetCssStylesEmpty() { var op = new DeltaInsertOp("aa"); var c = new OpToXmlConverter(op); c.GetCssStyles().Count().Should().Be(0); }
public void GetCssStylesFormula() { var o = new DeltaInsertOp(new InsertDataFormula(""), _styleAttributes); var c = new OpToXmlConverter(o, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(_styleAttributesCss); }
public void GetCssStylesWithInlineStylesManyStyles() { var op = new DeltaInsertOp("f", _styleAttributes); var c = new OpToXmlConverter(op, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(_styleAttributesCss); }
public void GetCssStylesWithInlineStylesNoStyles() { var op = new DeltaInsertOp("hello"); var c = new OpToXmlConverter(op, _styleConverterOptions); c.GetCssStyles().Should().Equal(new string[] { }); }
public void GetCssStylesBackgroundForeground() { var o = new DeltaInsertOp("f", new OpAttributes { Background = "red", Color = "blue" }); var c = new OpToXmlConverter(o); c.GetCssStyles().Should().Equal(new string[] { "color:blue", "background-color:red" }); }
public void GetCssStylesRendersDefaultFontsCorrectly() { var op = new DeltaInsertOp("f", new OpAttributes { Font = "monospace" }); var c = new OpToXmlConverter(op, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(new string[] { "font-family: Monaco, Courier New, monospace" }); }
public void GetCssStylesIndent() { var o = new DeltaInsertOp(new InsertDataImage(""), new OpAttributes { Indent = 2 }); var c = new OpToXmlConverter(o, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(new string[] { "padding-left:6em" }); }
public void GetCssStylesRtl() { var o = new DeltaInsertOp(new InsertDataImage(""), new OpAttributes { Direction = DirectionType.Rtl }); var c = new OpToXmlConverter(o, _styleConverterOptions); c.GetCssStyles().Should().BeEquivalentTo(new string[] { "direction:rtl; text-align:inherit" }); }
public void GetCssStylesAllowBackgroundClasses() { var o = new DeltaInsertOp("f", new OpAttributes { Background = "red", Color = "blue" }); var c = new OpToXmlConverter(o, new OpToXmlConverterOptions() { AllowBackgroundClasses = true }); c.GetCssStyles().Should().Equal(new string[] { "color:blue" }); }
public void GetCssStylesReturnsNothingWhereConverterIsNull() { var op = new DeltaInsertOp("f", new OpAttributes { Size = "biggest" }); var c = new OpToXmlConverter(op, new OpToXmlConverterOptions() { InlineStyles = new InlineStyles() { Size = null } }); c.GetCssStyles().Should().BeEquivalentTo(new string[] { }); }
public void GetCssStylesReturnsNothingWhereNoEntryMapped() { var op = new DeltaInsertOp("f", new OpAttributes { Size = "biggest" }); var styleDic = new Dictionary <string, string>() { { "small", "font-size: 0.75em" } }; var c = new OpToXmlConverter(op, new OpToXmlConverterOptions { InlineStyles = new InlineStyles() { Size = InlineStyles.MakeLookup(styleDic) } }); c.GetCssStyles().Should().BeEquivalentTo(new string[] { }); }
public void GetCssStylesCustomStyle() { var op = new DeltaInsertOp("f", new OpAttributes { Size = "huge" }); var styleDic = new Dictionary <string, string>() { { "huge", "font-size: 6em" } }; var c = new OpToXmlConverter(op, new OpToXmlConverterOptions() { InlineStyles = new InlineStyles() { Size = (value, dop) => InlineStyles.LookupValue(styleDic, value) } }); c.GetCssStyles().Should().BeEquivalentTo(new string[] { "font-size: 6em" }); }
public void GetCssStylesUsesDefaultsWhereUnspecified() { // Here there's no inlineStyle specified for "size", but we still render it // because we fall back to the default. var op = new DeltaInsertOp("f", new OpAttributes { Size = "huge" }); var styleDic = new Dictionary <string, string>() { { "serif", "font-family: serif" } }; var c = new OpToXmlConverter(op, new OpToXmlConverterOptions() { InlineStyles = new InlineStyles() { Font = (value, dop) => InlineStyles.LookupValue(styleDic, value) } }); c.GetCssStyles().Should().BeEquivalentTo(new string[] { "font-size: 2.5em" }); }