Skip to content

Commit

Permalink
Add Unit tests from less.js to catch bugs/features/differences
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeapage committed May 22, 2011
1 parent 34736e5 commit d439db5
Show file tree
Hide file tree
Showing 6 changed files with 686 additions and 67 deletions.
22 changes: 22 additions & 0 deletions src/dotless.Test/Specs/CssFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,28 @@ public void CheckUrlWithDataNotQuoted()
background: #eeeeee url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABlBMVEX///////9VfPVsAAAACklEQVQImWNgAAAAAgAB9HFkpgAAAABJRU5ErkJggg%3D%3D) repeat-y 13em 0;
}";
AssertLessUnchanged(input);
}

[Test]
[Ignore("Bug in dotless")]
public void HttpUrl()
{
// In MatchAny where we consider if we hit a comment token, instead of changing
// it to text we should re-parse the comment?
// or does the tokenizer need to be aware of url() as a special case? (see next bug)
AssertExpressionUnchanged(@"image: url(http://), ""}"", url(""http://}"")");
}

[Test]
[Ignore("Bug in dotless")]
public void HttpUrl2()
{
var input = @".trickyurl {
image: url(http://); }";
var expected = @".trickyurl {
image: url(http://);
}";
AssertLess(input, expected);
}
}
}
87 changes: 87 additions & 0 deletions src/dotless.Test/Specs/Functions/FormatStringFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,92 @@ public void FormatGradients()

AssertLess(input, expected);
}

[Test]
[Ignore("Supported by less.js, not by dotless")]
public void EscapeFunction()
{
var input = @"
#builtin {
@r: 32;
escaped: e(""-Some::weird(#thing, y)"");
}
";
var expected = @"
#built-in {
escaped: -Some::weird(#thing, y);
}";

AssertLess(input, expected);
}

[Test]
[Ignore("Supported by less.js, not by dotless")]
public void ShortFormatFunction()
{
var input = @"
#builtin {
@r: 32;
format: %(""rgb(%d, %d, %d)"", @r, 128, 64);
}
";
var expected = @"
#built-in {
format: ""rgb(32, 128, 64)"";
}";

AssertLess(input, expected);
}

[Test]
[Ignore("Supported by less.js, not by dotless")]
public void ShortFormatFunctionAcceptingString()
{
var input = @"
#builtin {
format-string: %(""hello %s"", ""world"");
}
";
var expected = @"
#built-in {
format-string: ""hello world"";
}";

AssertLess(input, expected);
}

[Test]
[Ignore("Supported by less.js, not by dotless")]
public void ShortFormatFunctionUrlEncode()
{
var input = @"
#builtin {
format-url-encode: %('red is %A', #ff0000);
}
";
var expected = @"
#built-in {
format-url-encode: ""red is %23ff0000"";
}";

AssertLess(input, expected);
}

[Test]
[Ignore("Supported by less.js, not by dotless")]
public void EscapeAndShortFormatFunction()
{
var input = @"
#builtin {
eformat: e(%(""rgb(%d, %d, %d)"", @r, 128, 64));
}
";
var expected = @"
#built-in {
eformat: rgb(32, 128, 64);
}";

AssertLess(input, expected);
}
}
}
Loading

0 comments on commit d439db5

Please sign in to comment.