Example #1
0
        public void GetCssData_Test()
        {
            var table1   = Doc2web.Tests.Samples.TableSimple.Build3x3();
            var grid1    = _instance.AddTable(table1, 0);
            var table2   = Doc2web.Tests.Samples.TableSimple.Build3x3();
            var grid2    = _instance.AddTable(table2, 0);
            var expected = new CssData();

            expected.AddRange(grid1.AsCssData());
            expected.AddRange(grid2.AsCssData());

            var result = _instance.GetCssData();

            Assert.AreEqual(expected, result);
        }
Example #2
0
        public CssData GetCssData()
        {
            var cssData = new CssData();

            foreach (var grid in _grids)
            {
                cssData.AddRange(grid.AsCssData());
            }
            return(cssData);
        }
Example #3
0
        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);
        }
Example #4
0
        private IElementProcessingState MockElemProcessingStateWithTableContext()
        {
            var tableContext = new TableContext()
            {
                GridStateFactory = _instance.GridStateFactory
            };

            tableContext.AddTable(TableSimple.Build3x3(), 0);
            _fullCssData.AddRange(tableContext.GetCssData());
            var elemState = new ElementProcessingState();

            elemState.SetContext(tableContext);
            return(elemState);
        }
Example #5
0
        public void AddRange_Test()
        {
            var expected = new CssData();

            expected.AddAttribute("span", "color", "red");
            expected.AddAttribute("span", "font", "bold");
            expected.AddAttribute("p", "margin-top", "20px");

            var cssData1 = new CssData();

            cssData1.AddAttribute("span", "color", "blue");
            cssData1.AddAttribute("span", "font", "bold");

            var cssData2 = new CssData();

            cssData2.AddAttribute("span", "color", "red");
            cssData2.AddAttribute("p", "margin-top", "20px");

            cssData1.AddRange(cssData2);

            Assert.AreEqual(expected, cssData1);
        }
Example #6
0
 public void InsertCss(CssPropertiesSet other, CssData cssData)
 {
     cssData.AddRange(_cssData);
 }