示例#1
0
        public void Construct()
        {
            var gap = new CssGap(CssUnitValue.Parse("10%"));

            Assert.Equal("10%", gap.X.ToString());
            Assert.Equal("10%", gap.Y.ToString());
        }
示例#2
0
        public void C()
        {
            var dic = new Dictionary <string, CssValue>
            {
                ["columnCount"] = CssValue.Parse("5"),
                ["columnWidth"] = CssUnitValue.Number(100 / 5d),
                ["gap"]         = CssValue.Parse("10px")
            };

            var sheet = StyleSheet.Parse(@"

@for $i from 1 through $columnCount { 
  .col-#{$i} { 
    left: #{$columnWidth * $i}%;
    margin: $gap * 0.5; 
  }
}

");

            Assert.Equal(@"
.col-1 {
  left: 20%;
  margin: 5px;
}
.col-2 {
  left: 40%;
  margin: 5px;
}
.col-3 {
  left: 60%;
  margin: 5px;
}
.col-4 {
  left: 80%;
  margin: 5px;
}
.col-5 {
  left: 100%;
  margin: 5px;
}

".Trim(), sheet.ToString(dic));
        }