Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created March 12, 2011 17:58
Show Gist options
  • Select an option

  • Save wfaler/867408 to your computer and use it in GitHub Desktop.

Select an option

Save wfaler/867408 to your computer and use it in GitHub Desktop.
SimpleSqueryTest.scala
import org.scalatest.FunSuite
import xml.NodeSeq
import org.fusesource.scalate.scuery.{Transform, Transformer}
class SimpleSqueryTest extends FunSuite{
test("hello"){
println(transformer(seq))
}
def seq = <div id="content">
<table class="people">
<tr>
<th>Name</th>
<th>Location</th>
</tr>
<tr class="person">
<td class="name">DummyName</td>
<td class="location">DummyLocation</td>
</tr>
</table>
</div>
}
case class Person(name: String, location: String)
object transformer extends Transformer {
val people = List(Person("James", "Mells"),
Person("Hiram", "Tampa"))
$(".person") { node =>
people.flatMap { p =>
new Transform(node) {
$(".name").contents = p.name
$(".location").contents = p.location
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment