diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-11-05 06:37:03 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-11-05 06:37:03 -0800 |
commit | 8e8f9bb1d2e05d946ba55e273027d05345057d4d (patch) | |
tree | cfdb80268a283aac1bc91ee54c55cf302ce55a4f /scalatexApi/src/test/scala/scalatex/BasicTests.scala | |
parent | a99ca0a1c4df83638d888d316a453b6516477a08 (diff) | |
download | hands-on-scala-js-8e8f9bb1d2e05d946ba55e273027d05345057d4d.tar.gz hands-on-scala-js-8e8f9bb1d2e05d946ba55e273027d05345057d4d.tar.bz2 hands-on-scala-js-8e8f9bb1d2e05d946ba55e273027d05345057d4d.zip |
If-elses-fors work and are tested
Diffstat (limited to 'scalatexApi/src/test/scala/scalatex/BasicTests.scala')
-rw-r--r-- | scalatexApi/src/test/scala/scalatex/BasicTests.scala | 272 |
1 files changed, 136 insertions, 136 deletions
diff --git a/scalatexApi/src/test/scala/scalatex/BasicTests.scala b/scalatexApi/src/test/scala/scalatex/BasicTests.scala index 2412456..4bc362c 100644 --- a/scalatexApi/src/test/scala/scalatex/BasicTests.scala +++ b/scalatexApi/src/test/scala/scalatex/BasicTests.scala @@ -193,22 +193,22 @@ object BasicTests extends TestSuite{ """ ) } -// 'linearNested{ -// check( -// tw(""" -// @h1 @span @a Hello World -// @h2 @span @a hello -// @b world -// @h3 @i -// @div Cow -// """), -// """ -// <h1></h1><span></span><a></a>HelloWorld -// <h2></h2><span></span><a></a>hello<b></b>world -// <h3></h3><i></i><div></div>Cow -// """ -// ) -// } + 'linearNested{ + check( + tw(""" + @h1 @span @a Hello World + @h2 @span @a hello + @b world + @h3 @i + @div Cow + """), + """ + <h1></h1><span></span><a></a>HelloWorld + <h2></h2><span></span><a></a>hello<b></b>world + <h3></h3><i></i><div></div>Cow + """ + ) + } 'crasher{ tw(""" @html @@ -294,9 +294,9 @@ object BasicTests extends TestSuite{ // """ // ) // } -// } + } // -// 'loops { + 'loops { // * - check( tw(""" @@ -310,124 +310,124 @@ object BasicTests extends TestSuite{ """), "lollollol" ) -// -// -// * - check( -// tw(""" -// @p -// @for(x <- 0 until 2) -// @for(y <- 0 until 2) -// lol@x@y -// """), -// tw( """ -// @p -// @for(x <- 0 until 2) { -// @for(y <- 0 until 2) -// lol@x@y -// } -// """), -// tw(""" -// @p -// @for(x <- 0 until 2) -// @for(y <- 0 until 2){ -// lol@x@y -// } -// """), -// "<p>lol00lol01lol10lol11</p>" -// ) -// check( -// tw(""" -// @p -// @for(x <- 0 until 2) -// @for(y <- 0 until 2) -// lol@x@y -// """), -// "<p>lol00lol01lol10lol11</p>" -// ) -// -// * - check( -// tw( -// """ -// @for(x <- 0 until 2; y <- 0 until 2) -// @div{@x@y} -// -// """), -// """<div>00</div><div>01</div><div>10</div><div>11</div>""" -// ) -// } -// -// 'ifElse{ -// 'basicExamples{ -// * - check( -// tw(""" -// @if(false) -// Hello -// @else -// lols -// @p -// """), -// "lols<p></p>" -// ) -// -// * - check( -// tw(""" -// @div -// @if(true) -// Hello -// @else -// lols -// """), -// "<div>Hello</div>" -// ) -// -// * - check( -// tw(""" -// @div -// @if(true) -// Hello -// @else -// lols -// """), -// "<div>Hello</div>" -// ) -// * - check( -// tw(""" -// @if(false) -// Hello -// @else -// lols -// """), -// "lols" -// ) -// * - check( -// tw(""" -// @if(false) -// Hello -// @else -// lols -// @img -// """), -// "lols<img/>" -// ) -// * - check( -// tw(""" -// @p -// @if(true) -// Hello -// @else -// lols -// """), -// tw(""" -// @p -// @if(true) { -// Hello -// } else { -// lols -// } -// """), -// "<p>Hello</p>" -// ) -// } + + + * - check( + tw(""" + @p + @for(x <- 0 until 2) + @for(y <- 0 until 2) + lol@x@y + """), + tw( """ + @p + @for(x <- 0 until 2){ + @for(y <- 0 until 2) + lol@x@y + } + """), + tw(""" + @p + @for(x <- 0 until 2) + @for(y <- 0 until 2){ + lol@x@y + } + """), + "<p>lol00lol01lol10lol11</p>" + ) + check( + tw(""" + @p + @for(x <- 0 until 2) + @for(y <- 0 until 2) + lol@x@y + """), + "<p>lol00lol01lol10lol11</p>" + ) + + * - check( + tw( + """ + @for(x <- 0 until 2; y <- 0 until 2) + @div{@x@y} + + """), + """<div>00</div><div>01</div><div>10</div><div>11</div>""" + ) + } + + 'ifElse{ + 'basicExamples{ + * - check( + tw(""" + @if(false) + Hello + @else + lols + @p + """), + "lols<p></p>" + ) + + * - check( + tw(""" + @div + @if(true) + Hello + @else + lols + """), + "<div>Hello</div>" + ) + + * - check( + tw(""" + @div + @if(true) + Hello + @else + lols + """), + "<div>Hello</div>" + ) + * - check( + tw(""" + @if(false) + Hello + @else + lols + """), + "lols" + ) + * - check( + tw(""" + @if(false) + Hello + @else + lols + @img + """), + "lols<img/>" + ) + * - check( + tw(""" + @p + @if(true) + Hello + @else + lols + """), + tw(""" + @p + @if(true){ + Hello + }else{ + lols + } + """), + "<p>Hello</p>" + ) + } // 'funkyExpressions{ // * - check( // tw(""" |