Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 group('appendText', () { | 67 group('appendText', () { |
| 68 test('htmlelement', () { | 68 test('htmlelement', () { |
| 69 var el = new DivElement(); | 69 var el = new DivElement(); |
| 70 el.appendText('foo'); | 70 el.appendText('foo'); |
| 71 // No children were created. | 71 // No children were created. |
| 72 expect(el.children.length, equals(0)); | 72 expect(el.children.length, equals(0)); |
| 73 // One text node was added. | 73 // One text node was added. |
| 74 expect(el.nodes.length, equals(1)); | 74 expect(el.nodes.length, equals(1)); |
| 75 }); | 75 }); |
| 76 | 76 |
| 77 test('htmlelement', () { | |
| 78 var el = new DivElement(); | |
| 79 var twoNewLines = "\n\n"; | |
| 80 el.appendText(twoNewLines); | |
| 81 // No children were created. | |
| 82 expect(el.children.length, equals(0)); | |
| 83 // One text node was added. | |
| 84 expect(el.nodes.length, equals(1)); | |
| 85 expect(el.nodes[0], isText); | |
| 86 expect(el.nodes[0].text, equals(twoNewLines)); | |
|
ahe
2014/08/27 11:48:48
Suggest adding:
expect(el.text, equals(twoNewLine
| |
| 87 }); | |
| 88 | |
| 77 test('documentFragment', () { | 89 test('documentFragment', () { |
| 78 var fragment = new DocumentFragment(); | 90 var fragment = new DocumentFragment(); |
| 79 fragment.appendText('foo'); | 91 fragment.appendText('foo'); |
| 80 // No children were created. | 92 // No children were created. |
| 81 expect(fragment.children.length, equals(0)); | 93 expect(fragment.children.length, equals(0)); |
| 82 // One text node was added. | 94 // One text node was added. |
| 83 expect(fragment.nodes.length, equals(1)); | 95 expect(fragment.nodes.length, equals(1)); |
| 84 }); | 96 }); |
| 85 }); | 97 }); |
| 86 | 98 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 var child = new DivElement(); | 231 var child = new DivElement(); |
| 220 parent.children.add(child); | 232 parent.children.add(child); |
| 221 | 233 |
| 222 parent.insertAdjacentText('beforeend', 'test'); | 234 parent.insertAdjacentText('beforeend', 'test'); |
| 223 | 235 |
| 224 expect(parent.nodes.length, 2); | 236 expect(parent.nodes.length, 2); |
| 225 expect(parent.nodes[1], isText); | 237 expect(parent.nodes[1], isText); |
| 226 }); | 238 }); |
| 227 }); | 239 }); |
| 228 } | 240 } |
| OLD | NEW |