@@ -23,6 +23,8 @@ package nl.adaptivity.xmlutil
23
23
import nl.adaptivity.xmlutil.dom2.Element
24
24
import nl.adaptivity.xmlutil.dom2.documentElement
25
25
import nl.adaptivity.xmlutil.serialization.writeAsXML
26
+ import nl.adaptivity.xmlutil.test.multiplatform.Target
27
+ import nl.adaptivity.xmlutil.test.multiplatform.testTarget
26
28
import kotlin.test.Test
27
29
import kotlin.test.assertEquals
28
30
@@ -33,12 +35,14 @@ class TestDom {
33
35
*/
34
36
@Test
35
37
fun test_getElementsByTagName_withNestedTags_worksCorrectly () {
36
- val element = getTestElementRoot()
38
+ if (testTarget != Target .Node ) {
39
+ val element = getTestElementRoot()
37
40
// .decodeFromString(Element.serializer(), NESTED_ELEMENTS_TAG_SOUP)
38
- val children = element.getElementsByTagName(" child" ).toList()
39
- assertEquals(16 , children.size)
40
- children.forEachIndexed { index, node ->
41
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
41
+ val children = element.getElementsByTagName(" child" ).toList()
42
+ assertEquals(16 , children.size)
43
+ children.forEachIndexed { index, node ->
44
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
45
+ }
42
46
}
43
47
}
44
48
@@ -47,12 +51,14 @@ class TestDom {
47
51
*/
48
52
@Test
49
53
fun test_getElementsByTagNameWildcard_withNestedTags_worksCorrectly () {
50
- val element = getTestElementRoot()
54
+ if (testTarget != Target .Node ) {
55
+ val element = getTestElementRoot()
51
56
// .decodeFromString(Element.serializer(), NESTED_ELEMENTS_TAG_SOUP)
52
- val children = element.getElementsByTagName(" *" ).toList()
53
- assertEquals(16 , children.size)
54
- children.forEachIndexed { index, node ->
55
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
57
+ val children = element.getElementsByTagName(" *" ).toList()
58
+ assertEquals(16 , children.size)
59
+ children.forEachIndexed { index, node ->
60
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
61
+ }
56
62
}
57
63
}
58
64
@@ -61,12 +67,14 @@ class TestDom {
61
67
*/
62
68
@Test
63
69
fun test_getElementsByTagNameNS_withNestedTags_worksCorrectly () {
64
- val element = getTestElementRoot()
70
+ if (testTarget != Target .Node ) {
71
+ val element = getTestElementRoot()
65
72
// .decodeFromString(Element.serializer(), NESTED_ELEMENTS_TAG_SOUP)
66
- val children = element.getElementsByTagNameNS(" " , " child" ).toList()
67
- assertEquals(16 , children.size)
68
- children.forEachIndexed { index, node ->
69
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
73
+ val children = element.getElementsByTagNameNS(" " , " child" ).toList()
74
+ assertEquals(16 , children.size)
75
+ children.forEachIndexed { index, node ->
76
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
77
+ }
70
78
}
71
79
}
72
80
@@ -75,12 +83,14 @@ class TestDom {
75
83
*/
76
84
@Test
77
85
fun test_getElementsByTagNameNSWildcard_withNestedTags_worksCorrectly () {
78
- val element = getTestElementRoot()
86
+ if (testTarget != Target .Node ) {
87
+ val element = getTestElementRoot()
79
88
// .decodeFromString(Element.serializer(), NESTED_ELEMENTS_TAG_SOUP)
80
- val children = element.getElementsByTagNameNS(" *" , " *" ).toList()
81
- assertEquals(16 , children.size)
82
- children.forEachIndexed { index, node ->
83
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
89
+ val children = element.getElementsByTagNameNS(" *" , " *" ).toList()
90
+ assertEquals(16 , children.size)
91
+ children.forEachIndexed { index, node ->
92
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
93
+ }
84
94
}
85
95
}
86
96
@@ -89,12 +99,14 @@ class TestDom {
89
99
*/
90
100
@Test
91
101
fun test_getElementsByTagNameNSWildcardPart_withNestedTags_worksCorrectly () {
92
- val element = getTestElementRoot()
102
+ if (testTarget != Target .Node ) {
103
+ val element = getTestElementRoot()
93
104
// .decodeFromString(Element.serializer(), NESTED_ELEMENTS_TAG_SOUP)
94
- val children = element.getElementsByTagNameNS(" *" , " child" ).toList()
95
- assertEquals(16 , children.size)
96
- children.forEachIndexed { index, node ->
97
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
105
+ val children = element.getElementsByTagNameNS(" *" , " child" ).toList()
106
+ assertEquals(16 , children.size)
107
+ children.forEachIndexed { index, node ->
108
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
109
+ }
98
110
}
99
111
}
100
112
@@ -103,11 +115,13 @@ class TestDom {
103
115
*/
104
116
@Test
105
117
fun test_getElementsByTagNameNSWildcardPartLocal_withNestedTags_worksCorrectly () {
106
- val element = getTestElementRoot()
107
- val children = element.getElementsByTagNameNS(" " , " *" ).toList()
108
- assertEquals(16 , children.size)
109
- children.forEachIndexed { index, node ->
110
- assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
118
+ if (testTarget != Target .Node ) {
119
+ val element = getTestElementRoot()
120
+ val children = element.getElementsByTagNameNS(" " , " *" ).toList()
121
+ assertEquals(16 , children.size)
122
+ children.forEachIndexed { index, node ->
123
+ assertEquals((node as Element ).getAttribute(" prop" ), index.toString())
124
+ }
111
125
}
112
126
}
113
127
@@ -116,9 +130,11 @@ class TestDom {
116
130
*/
117
131
@Test
118
132
fun test_getElementsByTagNameNSWildcardNonMatchingLocal_withNestedTags_worksCorrectly () {
119
- val element = getTestElementRoot()
120
- val children = element.getElementsByTagNameNS(" xx" , " *" ).toList()
121
- assertEquals(0 , children.size)
133
+ if (testTarget != Target .Node ) {
134
+ val element = getTestElementRoot()
135
+ val children = element.getElementsByTagNameNS(" xx" , " *" ).toList()
136
+ assertEquals(0 , children.size)
137
+ }
122
138
}
123
139
124
140
companion object {
0 commit comments