| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file | 3 // BSD-style license that can be found in the LICENSE file |
| 4 | 4 |
| 5 library ElementAddTest; | 5 library ElementAddTest; |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
| 7 import '../../pkg/unittest/lib/html_config.dart'; | 7 import '../../pkg/unittest/lib/html_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 part 'util.dart'; | 9 part 'util.dart'; |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 var newChild = new SpanElement(); | 104 var newChild = new SpanElement(); |
| 105 parent.children.add(child); | 105 parent.children.add(child); |
| 106 | 106 |
| 107 parent.insertAdjacentElement('beforeend', newChild); | 107 parent.insertAdjacentElement('beforeend', newChild); |
| 108 | 108 |
| 109 expect(parent.children.length, 2); | 109 expect(parent.children.length, 2); |
| 110 expect(parent.children[1], isSpanElement); | 110 expect(parent.children[1], isSpanElement); |
| 111 }); | 111 }); |
| 112 }); | 112 }); |
| 113 | 113 |
| 114 group('insertAdjacentHTML', () { | 114 group('insertAdjacentHtml', () { |
| 115 test('beforebegin', () { | 115 test('beforebegin', () { |
| 116 var parent = new DivElement(); | 116 var parent = new DivElement(); |
| 117 var child = new DivElement(); | 117 var child = new DivElement(); |
| 118 parent.children.add(child); | 118 parent.children.add(child); |
| 119 | 119 |
| 120 child.insertAdjacentHTML('beforebegin', '<span></span>'); | 120 child.insertAdjacentHtml('beforebegin', '<span></span>'); |
| 121 | 121 |
| 122 expect(parent.children.length, 2); | 122 expect(parent.children.length, 2); |
| 123 expect(parent.children[0], isSpanElement); | 123 expect(parent.children[0], isSpanElement); |
| 124 }); | 124 }); |
| 125 | 125 |
| 126 test('afterend', () { | 126 test('afterend', () { |
| 127 var parent = new DivElement(); | 127 var parent = new DivElement(); |
| 128 var child = new DivElement(); | 128 var child = new DivElement(); |
| 129 parent.children.add(child); | 129 parent.children.add(child); |
| 130 | 130 |
| 131 child.insertAdjacentHTML('afterend', '<span></span>'); | 131 child.insertAdjacentHtml('afterend', '<span></span>'); |
| 132 | 132 |
| 133 expect(parent.children.length, 2); | 133 expect(parent.children.length, 2); |
| 134 expect(parent.children[1], isSpanElement); | 134 expect(parent.children[1], isSpanElement); |
| 135 }); | 135 }); |
| 136 | 136 |
| 137 test('afterbegin', () { | 137 test('afterbegin', () { |
| 138 var parent = new DivElement(); | 138 var parent = new DivElement(); |
| 139 var child = new DivElement(); | 139 var child = new DivElement(); |
| 140 parent.children.add(child); | 140 parent.children.add(child); |
| 141 | 141 |
| 142 parent.insertAdjacentHTML('afterbegin', '<span></span>'); | 142 parent.insertAdjacentHtml('afterbegin', '<span></span>'); |
| 143 | 143 |
| 144 expect(parent.children.length, 2); | 144 expect(parent.children.length, 2); |
| 145 expect(parent.children[0], isSpanElement); | 145 expect(parent.children[0], isSpanElement); |
| 146 }); | 146 }); |
| 147 | 147 |
| 148 test('beforeend', () { | 148 test('beforeend', () { |
| 149 var parent = new DivElement(); | 149 var parent = new DivElement(); |
| 150 var child = new DivElement(); | 150 var child = new DivElement(); |
| 151 parent.children.add(child); | 151 parent.children.add(child); |
| 152 | 152 |
| 153 parent.insertAdjacentHTML('beforeend', '<span></span>'); | 153 parent.insertAdjacentHtml('beforeend', '<span></span>'); |
| 154 | 154 |
| 155 expect(parent.children.length, 2); | 155 expect(parent.children.length, 2); |
| 156 expect(parent.children[1], isSpanElement); | 156 expect(parent.children[1], isSpanElement); |
| 157 }); | 157 }); |
| 158 }); | 158 }); |
| 159 | 159 |
| 160 group('insertAdjacentText', () { | 160 group('insertAdjacentText', () { |
| 161 test('beforebegin', () { | 161 test('beforebegin', () { |
| 162 var parent = new DivElement(); | 162 var parent = new DivElement(); |
| 163 var child = new DivElement(); | 163 var child = new DivElement(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 var child = new DivElement(); | 196 var child = new DivElement(); |
| 197 parent.children.add(child); | 197 parent.children.add(child); |
| 198 | 198 |
| 199 parent.insertAdjacentText('beforeend', 'test'); | 199 parent.insertAdjacentText('beforeend', 'test'); |
| 200 | 200 |
| 201 expect(parent.nodes.length, 2); | 201 expect(parent.nodes.length, 2); |
| 202 expect(parent.nodes[1], isText); | 202 expect(parent.nodes[1], isText); |
| 203 }); | 203 }); |
| 204 }); | 204 }); |
| 205 } | 205 } |
| OLD | NEW |