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

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

Issue 26557004: Fix for events not firing on sanitized elements (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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 ElementTest; 5 library ElementTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 document.body.append(table); 213 document.body.append(table);
214 var tBody = table.createTBody(); 214 var tBody = table.createTBody();
215 var tRow = tBody.addRow(); 215 var tRow = tBody.addRow();
216 var node = tRow.createFragment('<th>foobar').nodes.single; 216 var node = tRow.createFragment('<th>foobar').nodes.single;
217 expect(node, predicate((x) => x is TableCellElement, 217 expect(node, predicate((x) => x is TableCellElement,
218 'is a TableCellElement')); 218 'is a TableCellElement'));
219 expect(node.tagName, 'TH'); 219 expect(node.tagName, 'TH');
220 expect(node.parent, isNull); 220 expect(node.parent, isNull);
221 expect(node.innerHtml, 'foobar'); 221 expect(node.innerHtml, 'foobar');
222 }); 222 });
223
224 test('.html can fire events', () {
225 var e = new Element.html('<button>aha</button>');
226 var gotEvent = false;
227 e.onClick.listen((_) {
228 gotEvent = true;
229 });
230 e.click();
231 expect(gotEvent, isTrue, reason: 'click should have raised click event');
232 });
223 }); 233 });
224 234
225 group('eventListening', () { 235 group('eventListening', () {
226 test('streams', () { 236 test('streams', () {
227 final target = new Element.tag('div'); 237 final target = new Element.tag('div');
228 238
229 void testEvent(Stream stream, String type) { 239 void testEvent(Stream stream, String type) {
230 var firedOnEvent = false; 240 var firedOnEvent = false;
231 stream.listen((e) { 241 stream.listen((e) {
232 firedOnEvent = true; 242 firedOnEvent = true;
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 925
916 test('sublist', () { 926 test('sublist', () {
917 var range = makeElementList().sublist(1, 3); 927 var range = makeElementList().sublist(1, 3);
918 expect(range.length, 2); 928 expect(range.length, 2);
919 expect(range[0], isBRElement); 929 expect(range[0], isBRElement);
920 expect(range[1], isBRElement); 930 expect(range[1], isBRElement);
921 }); 931 });
922 932
923 }); 933 });
924 } 934 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698