added a nicer subscript navigation of DOM kinda like jquery but without the $ :)
This commit is contained in:
@@ -11,6 +11,10 @@ class DomBuilderTest() : TestSupport() {
|
||||
fun testBuildDocument() {
|
||||
var doc = createDocument()
|
||||
|
||||
assert {
|
||||
doc["grandchild"].isEmpty()
|
||||
}
|
||||
|
||||
doc.addElement("foo") {
|
||||
id = "id1"
|
||||
style = "bold"
|
||||
@@ -27,8 +31,7 @@ class DomBuilderTest() : TestSupport() {
|
||||
}
|
||||
println("builder document: ${doc.toXmlString()}")
|
||||
|
||||
|
||||
val grandChild = doc.elementsByTagName("grandChild").first
|
||||
val grandChild = doc["grandChild"].first
|
||||
if (grandChild != null) {
|
||||
println("got element ${grandChild.toXmlString()} with text '${grandChild.text}`")
|
||||
assertEquals("Hello World!", grandChild.text)
|
||||
|
||||
Reference in New Issue
Block a user