コード例 #1
0
        internal override void Load()
        {
            var href = GetAttribute("href");

            if (href == null)
            {
                return;
            }

            var pathToFile = href.Value.Replace("\"", "");

            var cssLoader = new CssLoader();

            Sheet           = cssLoader.LoadFromFile(pathToFile);
            Sheet.Href      = pathToFile;
            Sheet.OwnerNode = this;

            OwnerDocument.StyleSheets.Add(Sheet);
        }
コード例 #2
0
ファイル: CSSMarginTests.cs プロジェクト: Winster332/Quantum
        public void MarginFromFile_Full_Test()
        {
            var loader = new CssLoader();
            var sheet  = loader.LoadFromFile("Contents/css/test_margin_style.css");

            sheet.CssRules.Should().HaveCount(3);
            var margin = sheet.CssRules[2];

            margin.SelectorText.Should().BeEquivalentTo(".marginFourFieldTest");

            margin.Style.Margin.Top.Type.Should().BeEquivalentTo(CSSNumberType.Px);
            margin.Style.Margin.Top.Value.Should().BeGreaterOrEqualTo(10);

            margin.Style.Margin.Right.Type.Should().BeEquivalentTo(CSSNumberType.Px);
            margin.Style.Margin.Right.Value.Should().BeGreaterOrEqualTo(1);

            margin.Style.Margin.Bottom.Type.Should().BeEquivalentTo(CSSNumberType.Px);
            margin.Style.Margin.Bottom.Value.Should().BeGreaterOrEqualTo(5);

            margin.Style.Margin.Left.Type.Should().BeEquivalentTo(CSSNumberType.Px);
            margin.Style.Margin.Left.Value.Should().BeGreaterOrEqualTo(15);
        }