Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1077)

Unified Diff: tests/html/element_add_test.dart

Issue 11316121: Changes to make it easier to add elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/element_add_test.dart
diff --git a/tests/html/element_add_test.dart b/tests/html/element_add_test.dart
index ef911fdd90ca8fe3fe71d930e8b29e69e2d98fde..7eb6c50fcd13f219cfe4518d86b69f11c77cfd89 100644
--- a/tests/html/element_add_test.dart
+++ b/tests/html/element_add_test.dart
@@ -18,15 +18,15 @@ main() {
void expectNoSuchMethod(void fn()) =>
expect(fn, throwsNoSuchMethodError);
- group('addHtml', () {
+ group('append', () {
test('htmlelement', () {
var el = new DivElement();
- el.addHtml('<span></span>');
+ el.append(new SpanElement());
expect(el.children.length, equals(1));
var span = el.children[0];
expect(span, isSpanElement);
- el.addHtml('<div></div>');
+ el.append(new DivElement());
expect(el.children.length, equals(2));
// Validate that the first item is still first.
expect(el.children[0], equals(span));
@@ -35,16 +35,39 @@ main() {
test('documentFragment', () {
var fragment = new DocumentFragment();
- fragment.addHtml('<span>something</span>');
+ fragment.append(new SpanElement());
expect(fragment.children.length, equals(1));
expect(fragment.children[0], isSpanElement);
});
});
- group('addText', () {
+ group('appendHtml', () {
test('htmlelement', () {
var el = new DivElement();
- el.addText('foo');
+ el.appendHtml('<span></span>');
+ expect(el.children.length, equals(1));
+ var span = el.children[0];
+ expect(span, isSpanElement);
+
+ el.appendHtml('<div></div>');
+ expect(el.children.length, equals(2));
+ // Validate that the first item is still first.
+ expect(el.children[0], equals(span));
+ expect(el.children[1], isDivElement);
+ });
+
+ test('documentFragment', () {
+ var fragment = new DocumentFragment();
+ fragment.appendHtml('<span>something</span>');
+ expect(fragment.children.length, equals(1));
+ expect(fragment.children[0], isSpanElement);
+ });
+ });
+
+ group('appendText', () {
+ test('htmlelement', () {
+ var el = new DivElement();
+ el.appendText('foo');
// No children were created.
expect(el.children.length, equals(0));
// One text node was added.
@@ -53,7 +76,7 @@ main() {
test('documentFragment', () {
var fragment = new DocumentFragment();
- fragment.addText('foo');
+ fragment.appendText('foo');
// No children were created.
expect(fragment.children.length, equals(0));
// One text node was added.
« no previous file with comments | « sdk/lib/html/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698