added an extra test case for DOM text addition

This commit is contained in:
James Strachan
2012-04-12 12:11:01 +01:00
parent 937c713ea7
commit 46dbd19433
+17 -4
View File
@@ -4,15 +4,15 @@ import kotlin.*
import kotlin.dom.*
import kotlin.test.*
import org.w3c.dom.*
import junit.framework.TestCase
import org.junit.Test as test
class DomTest() : TestCase() {
class DomTest {
fun testCreateDocument() {
test fun testCreateDocument() {
var doc = createDocument()
assertNotNull(doc, "Should have created a document")
val e = doc.createElement("foo").sure()
val e = doc.createElement("foo")!!
assertCssClass(e, "")
// now lets update the cssClass property
@@ -27,6 +27,19 @@ class DomTest() : TestCase() {
println("document ${doc.toXmlString()}")
}
test fun addText() {
var doc = createDocument()
assertNotNull(doc, "Should have created a document")
val e = doc.createElement("foo")!!
e + "hello"
println("element after text ${e.toXmlString()}")
assertEquals("hello", e.text)
}
fun assertCssClass(e: Element, value: String?): Unit {
val cl = e.classes