Created
March 12, 2011 17:58
-
-
Save wfaler/867408 to your computer and use it in GitHub Desktop.
SimpleSqueryTest.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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