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

Side by Side Diff: tests/html/htmlelement_test.dart

Issue 26917002: Convert keys in dataSet to camelCase instead of dasherized. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/AttributeMap.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library ElementTest; 1 library ElementTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 5
6 main() { 6 main() {
7 useHtmlConfiguration(); 7 useHtmlConfiguration();
8 test('InnerHTML', () { 8 test('InnerHTML', () {
9 Element element = new Element.tag('div'); 9 Element element = new Element.tag('div');
10 element.id = 'test'; 10 element.id = 'test';
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 expect(div.dataset.length, 2); 80 expect(div.dataset.length, 2);
81 expect(div.dataset.isEmpty, isFalse); 81 expect(div.dataset.isEmpty, isFalse);
82 82
83 expect(div.dataset.remove('foo'), 'foo-value'); 83 expect(div.dataset.remove('foo'), 'foo-value');
84 expect(div.dataset.length, 1); 84 expect(div.dataset.length, 1);
85 expect(div.dataset.isEmpty, isFalse); 85 expect(div.dataset.isEmpty, isFalse);
86 86
87 div.dataset.clear(); 87 div.dataset.clear();
88 expect(div.dataset.length, 0); 88 expect(div.dataset.length, 0);
89 expect(div.dataset.isEmpty, isTrue); 89 expect(div.dataset.isEmpty, isTrue);
90
91 Element otherDiv = new Element.html(
92 '<div id="dataDiv" data-my-message="Hello World"></div>',
93 treeSanitizer: new UnhelpfulSanitizer());
94 expect(otherDiv.dataset.containsKey('myMessage'), isTrue);
95
96 Element anotherDiv = new Element.html(
97 '<div id="dataDiv" data-eggs="bacon"></div>',
98 treeSanitizer: new UnhelpfulSanitizer());
99 expect(anotherDiv.dataset.containsKey('eggs'), isTrue);
90 }); 100 });
91 } 101 }
102
103 /**
104 * A sanitizer that doesn't actually do anything! Allows us to add custom
105 * attributes (and anything else).
106 */
107 class UnhelpfulSanitizer implements NodeTreeSanitizer {
blois 2013/10/10 21:13:39 import utils.dart and use NullTreeSanitizer from t
108 UnhelpfulSanitizer();
109 void sanitizeTree(Node node) {}
110 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/src/AttributeMap.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698