Пример #1
0
        public void TestCompilesSimpleAstDownToSingleRule()
        {
            var ast      = simpleAst();
            var compiler = new AstCompiler();

            var results = compiler.Compile(ast).ToArray();

            Assert.That(results.Length, Is.EqualTo(1));
        }
Пример #2
0
        public void TestSassNodeWithoutDeclarationsDoesntGetYielded()
        {
            var ast = new FluentAstBuilder().SassNode("a", a =>
            {
            }).ToTree();

            var compiler = new AstCompiler();

            var results = compiler.Compile(ast);

            Assert.That(results.Count(), Is.EqualTo(0));
        }
Пример #3
0
        public void TestCompilesComplexAstToCorrectDeclarations()
        {
            var ast      = complexAst();
            var compiler = new AstCompiler();

            var rules         = compiler.Compile(ast).ToArray();
            var declarations0 = rules[0].Declarations.ToArray();
            var declarations1 = rules[1].Declarations.ToArray();
            var declarations2 = rules[2].Declarations.ToArray();

            Assert.That(declarations0[0], Is.EqualTo(new Declaration("font-size", "12px")));
            Assert.That(declarations0[1], Is.EqualTo(new Declaration("color", "red")));
            Assert.That(declarations0[2], Is.EqualTo(new Declaration("height", "64em")));

            Assert.That(declarations1[0], Is.EqualTo(new Declaration("margin", "0")));

            Assert.That(declarations2[0], Is.EqualTo(new Declaration("font-weight", "bold")));
        }