| 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 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'package:unittest/html_config.dart'; | 7 import 'package:unittest/html_config.dart'; |
| 8 import 'util.dart'; | 8 import 'util.dart'; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 test('htmlelement', () { | 77 test('htmlelement', () { |
| 78 var el = new DivElement(); | 78 var el = new DivElement(); |
| 79 var twoNewLines = "\n\n"; | 79 var twoNewLines = "\n\n"; |
| 80 el.appendText(twoNewLines); | 80 el.appendText(twoNewLines); |
| 81 // No children were created. | 81 // No children were created. |
| 82 expect(el.children.length, equals(0)); | 82 expect(el.children.length, equals(0)); |
| 83 // One text node was added. | 83 // One text node was added. |
| 84 expect(el.nodes.length, equals(1)); | 84 expect(el.nodes.length, equals(1)); |
| 85 expect(el.nodes[0], isText); | 85 expect(el.nodes[0], isText); |
| 86 expect(el.nodes[0].text, equals(twoNewLines)); | 86 expect(el.nodes[0].text, equals(twoNewLines)); |
| 87 expect(el.text, equals(twoNewLines)); |
| 87 }); | 88 }); |
| 88 | 89 |
| 89 test('documentFragment', () { | 90 test('documentFragment', () { |
| 90 var fragment = new DocumentFragment(); | 91 var fragment = new DocumentFragment(); |
| 91 fragment.appendText('foo'); | 92 fragment.appendText('foo'); |
| 92 // No children were created. | 93 // No children were created. |
| 93 expect(fragment.children.length, equals(0)); | 94 expect(fragment.children.length, equals(0)); |
| 94 // One text node was added. | 95 // One text node was added. |
| 95 expect(fragment.nodes.length, equals(1)); | 96 expect(fragment.nodes.length, equals(1)); |
| 96 }); | 97 }); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 var child = new DivElement(); | 232 var child = new DivElement(); |
| 232 parent.children.add(child); | 233 parent.children.add(child); |
| 233 | 234 |
| 234 parent.insertAdjacentText('beforeend', 'test'); | 235 parent.insertAdjacentText('beforeend', 'test'); |
| 235 | 236 |
| 236 expect(parent.nodes.length, 2); | 237 expect(parent.nodes.length, 2); |
| 237 expect(parent.nodes[1], isText); | 238 expect(parent.nodes[1], isText); |
| 238 }); | 239 }); |
| 239 }); | 240 }); |
| 240 } | 241 } |
| OLD | NEW |