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

Side by Side Diff: tests/lib_strong/html/event_customevent_test.dart

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: fix Created 3 years, 9 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
OLDNEW
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 EventCustomEventTest; 5 library EventCustomEventTest;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:js' as js; 10 import 'dart:js' as js;
(...skipping 26 matching lines...) Expand all
37 test('custom events from JS', () { 37 test('custom events from JS', () {
38 var scriptContents = ''' 38 var scriptContents = '''
39 var event = document.createEvent("CustomEvent"); 39 var event = document.createEvent("CustomEvent");
40 event.initCustomEvent("js_custom_event", true, true, {type: "detail"}); 40 event.initCustomEvent("js_custom_event", true, true, {type: "detail"});
41 window.dispatchEvent(event); 41 window.dispatchEvent(event);
42 '''; 42 ''';
43 43
44 var fired = false; 44 var fired = false;
45 window.on['js_custom_event'].listen((ev) { 45 window.on['js_custom_event'].listen((ev) {
46 fired = true; 46 fired = true;
47 expect(ev.detail, {'type': 'detail'}); 47 expect((ev as CustomEvent).detail, {'type': 'detail'});
48 }); 48 });
49 49
50 var script = new ScriptElement(); 50 var script = new ScriptElement();
51 script.text = scriptContents; 51 script.text = scriptContents;
52 document.body.append(script); 52 document.body.append(script);
53 53
54 expect(fired, isTrue); 54 expect(fired, isTrue);
55 }); 55 });
56 56
57 test('custom events to JS', () { 57 test('custom events to JS', () {
(...skipping 19 matching lines...) Expand all
77 var event = new CustomEvent('dart_custom_data_event', detail: data); 77 var event = new CustomEvent('dart_custom_data_event', detail: data);
78 78
79 var future = window.on['dart_custom_data_event'].first.then((_) { 79 var future = window.on['dart_custom_data_event'].first.then((_) {
80 expect(event.detail.dartValue, 666); 80 expect(event.detail.dartValue, 666);
81 }); 81 });
82 82
83 document.body.dispatchEvent(event); 83 document.body.dispatchEvent(event);
84 return future; 84 return future;
85 }); 85 });
86 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698