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

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

Issue 11679007: Adding support checks for partially supported element types and updating tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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 | « tests/html/element_types_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ElementWebKitTest; 5 library ElementWebKitTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_config.dart'; 7 import '../../pkg/unittest/lib/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 10
11 // NOTE: 11 // NOTE:
12 // These should ALL be webkit-specific items 12 // These should ALL be webkit-specific items
13 // Ideally all of these should be functional on all browsers and moved into 13 // Ideally all of these should be functional on all browsers and moved into
14 // element_test.dart. 14 // element_test.dart.
15 15
16 void testConstructorHelper(String tag, String htmlSnippet,
17 String expectedText, Function isExpectedClass) {
18 expect(isExpectedClass(new Element.tag(tag)), true);
19 final elementFromSnippet = new Element.html(htmlSnippet);
20 expect(isExpectedClass(elementFromSnippet), true);
21 expect(expectedText, elementFromSnippet.text);
22 }
23
24 void testEventHelper(EventListenerList listenerList, type, 16 void testEventHelper(EventListenerList listenerList, type,
25 [Function registerOnEventListener = null]) { 17 [Function registerOnEventListener = null]) {
26 bool firedWhenAddedToListenerList = false; 18 bool firedWhenAddedToListenerList = false;
27 bool firedOnEvent = false; 19 bool firedOnEvent = false;
28 listenerList.add((e) { 20 listenerList.add((e) {
29 firedWhenAddedToListenerList = true; 21 firedWhenAddedToListenerList = true;
30 }); 22 });
31 if (registerOnEventListener != null) { 23 if (registerOnEventListener != null) {
32 registerOnEventListener((e) { 24 registerOnEventListener((e) {
33 firedOnEvent = true; 25 firedOnEvent = true;
34 }); 26 });
35 } 27 }
36 28
37 final event = new Event(type); 29 final event = new Event(type);
38 listenerList.dispatch(event); 30 listenerList.dispatch(event);
39 31
40 expect(firedWhenAddedToListenerList, isTrue); 32 expect(firedWhenAddedToListenerList, isTrue);
41 if (registerOnEventListener != null) { 33 if (registerOnEventListener != null) {
42 expect(firedOnEvent, isTrue); 34 expect(firedOnEvent, isTrue);
43 } 35 }
44 } 36 }
45 37
46 main() { 38 main() {
47 useHtmlConfiguration(); 39 useHtmlConfiguration();
48 40
49 group('constructors', () {
50 test('details', () => testConstructorHelper('details',
51 '<details>foo</details>', 'foo',
52 (element) => element is DetailsElement));
53 test('embed', () => testConstructorHelper('embed',
54 '<embed>foo</embed>', '',
55 (element) => element is EmbedElement));
56 test('keygen', () => testConstructorHelper('keygen', '<keygen>', '',
57 (element) => element is KeygenElement));
58 test('marquee', () => testConstructorHelper('marquee',
59 '<marquee>foo</marquee>', 'foo',
60 (element) => element is MarqueeElement));
61 test('meter', () => testConstructorHelper('meter',
62 '<meter>foo</meter>', 'foo',
63 (element) => element is MeterElement));
64 test('object', () => testConstructorHelper('object',
65 '<object>foo</object>', 'foo',
66 (element) => element is ObjectElement));
67 });
68 41
69 group('events', () { 42 group('events', () {
70 final element = new Element.tag('div'); 43 final element = new Element.tag('div');
71 final on = element.on; 44 final on = element.on;
72 testEventHelper(on.transitionEnd, 'webkitTransitionEnd'); 45 testEventHelper(on.transitionEnd, 'webkitTransitionEnd');
73 testEventHelper(on.fullscreenChange, 'webkitfullscreenchange', 46 testEventHelper(on.fullscreenChange, 'webkitfullscreenchange',
74 (listener) => Testing.addEventListener(element, 47 (listener) => Testing.addEventListener(element,
75 'webkitfullscreenchange', listener, true)); 48 'webkitfullscreenchange', listener, true));
76 }); 49 });
77 } 50 }
78 51
79 52
80 53
OLDNEW
« no previous file with comments | « tests/html/element_types_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698