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

Side by Side Diff: test/js_interop_test.ts

Issue 2225953002: Strip more unused features. (Closed) Base URL: git@github.com:dart-lang/js_facade_gen.git@master
Patch Set: Created 4 years, 4 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
(Empty)
1 /// <reference path="../typings/mocha/mocha.d.ts"/>
2 import {expectTranslate} from './test_support';
3
4 // TODO(jacobr): merge these tests back in with the other tests. These tests are
5 // only separate because we expected at one point to integrate with TS2Dart
6 // instead of refactoring TS2Dart to only output facades.
7 describe('variables', () => {
8 it('should print variable declaration', () => {
9 expectTranslate('var a:number;').to.equal(`@JS()
10 external num get a;
11 @JS()
12 external set a(num v);`);
13 expectTranslate('var a;').to.equal(`@JS()
14 external get a;
15 @JS()
16 external set a(v);`);
17 expectTranslate('var a:any;').to.equal(`@JS()
18 external dynamic get a;
19 @JS()
20 external set a(dynamic v);`);
21 });
22 it('should transpile variable declaration lists', () => {
23 expectTranslate('var a: A;').to.equal(`@JS()
24 external A get a;
25 @JS()
26 external set a(A v);`);
27
28 expectTranslate('var a, b;').to.equal(`@JS()
29 external get a;
30 @JS()
31 external set a(v);
32 @JS()
33 external get b;
34 @JS()
35 external set b(v);`);
36 });
37 it('support vardecls containing more than one type (implicit or explicit)', () => {
38 expectTranslate('var a: A, b: B;').to.equal(`@JS()
39 external A get a;
40 @JS()
41 external set a(A v);
42 @JS()
43 external B get b;
44 @JS()
45 external set b(B v);`);
46 expectTranslate('var a: number, b: string;').to.equal(`@JS()
47 external num get a;
48 @JS()
49 external set a(num v);
50 @JS()
51 external String get b;
52 @JS()
53 external set b(String v);`);
54 });
55
56 it('supports const', () => {
57 expectTranslate('const a:number = 1;').to.equal(`@JS()
58 external num get a;`);
59
60 expectTranslate('const a:number = 1, b:number = 2;').to.equal(`@JS()
61 external num get a;
62 @JS()
63 external num get b;`);
64
65 expectTranslate('const a:string').to.equal(`@JS()
66 external String get a;`);
67
68 expectTranslate('const a:number, b:number;').to.equal(`@JS()
69 external num get a;
70 @JS()
71 external num get b;`);
72 });
73 });
74
75 describe('classes', () => {
76 it('should translate classes', () => {
77 expectTranslate('class X {}').to.equal(`@JS()
78 class X {
79 // @Ignore
80 X.fakeConstructor$();
81 }`);
82 });
83 it('should support extends', () => {
84 expectTranslate('class X extends Y {}').to.equal(`@JS()
85 class X extends Y {
86 // @Ignore
87 X.fakeConstructor$() : super.fakeConstructor$();
88 }`);
89 });
90 it('should support implements', () => {
91 expectTranslate('class X implements Y, Z {}').to.equal(`@JS()
92 class X implements Y, Z {
93 // @Ignore
94 X.fakeConstructor$();
95 }`);
96 });
97 it('should support implements', () => {
98 expectTranslate('class X extends Y implements Z {}').to.equal(`@JS()
99 class X extends Y implements Z {
100 // @Ignore
101 X.fakeConstructor$() : super.fakeConstructor$();
102 }`);
103 });
104 it('should support abstract', () => {
105 expectTranslate('abstract class X {}').to.equal(`@JS()
106 abstract class X {
107 // @Ignore
108 X.fakeConstructor$();
109 }`);
110 });
111 describe('members', () => {
112 it('supports empty declarations', () => {
113 expectTranslate('class X { ; }').to.equal(`@JS()
114 class X {
115 // @Ignore
116 X.fakeConstructor$();
117 }`);
118 });
119 it('supports fields', () => {
120 expectTranslate('class X { x: number; y: string; }').to.equal(`@JS()
121 class X {
122 // @Ignore
123 X.fakeConstructor$();
124 external num get x;
125 external set x(num v);
126 external String get y;
127 external set y(String v);
128 }`);
129 expectTranslate('class X { x; }').to.equal(`@JS()
130 class X {
131 // @Ignore
132 X.fakeConstructor$();
133 external get x;
134 external set x(v);
135 }`);
136 });
137 it('ignore field initializers', () => {
138 expectTranslate('class X { x: number = 42; }').to.equal(`@JS()
139 class X {
140 // @Ignore
141 X.fakeConstructor$();
142 external num get x;
143 external set x(num v);
144 }`);
145 });
146 it('supports visibility modifiers', () => {
147 expectTranslate('class X { private _x; x; }').to.equal(`@JS()
148 class X {
149 // @Ignore
150 X.fakeConstructor$();
151 external get JS$_x;
152 external set JS$_x(v);
153 external get x;
154 external set x(v);
155 }`);
156 expectTranslate('class X { private x; }').to.equal(`@JS()
157 class X {
158 // @Ignore
159 X.fakeConstructor$();
160 external get x;
161 external set x(v);
162 }`);
163 expectTranslate('class X { constructor (private x) {} }').to.equal(`@JS()
164 class X {
165 // @Ignore
166 X.fakeConstructor$();
167 external get x;
168 external set x(v);
169 external factory X(x);
170 }`);
171 expectTranslate('class X { _x; }').to.equal(`@JS()
172 class X {
173 // @Ignore
174 X.fakeConstructor$();
175 external get JS$_x;
176 external set JS$_x(v);
177 }`);
178 });
179 it('does not support protected', () => {
180 expectTranslate('class X { protected x; }').to.equal(`@JS()
181 class X {
182 // @Ignore
183 X.fakeConstructor$();
184 external get x;
185 external set x(v);
186 }`);
187 });
188 it('supports static fields', () => {
189 expectTranslate('class X { static x: number = 42; }').to.equal(`@JS()
190 class X {
191 // @Ignore
192 X.fakeConstructor$();
193 external static num get x;
194 external static set x(num v);
195 }`);
196 });
197 it('supports methods', () => {
198 expectTranslate('class X { x() { return 42; } }').to.equal(`@JS()
199 class X {
200 // @Ignore
201 X.fakeConstructor$();
202 external x();
203 }`);
204 });
205 it('supports abstract methods', () => {
206 expectTranslate('abstract class X { abstract x(); }').to.equal(`@JS()
207 abstract class X {
208 // @Ignore
209 X.fakeConstructor$();
210 external x();
211 }`);
212 });
213 it('supports method return types', () => {
214 expectTranslate('class X { x(): number { return 42; } }').to.equal(`@JS()
215 class X {
216 // @Ignore
217 X.fakeConstructor$();
218 external num x();
219 }`);
220 });
221 it('supports method params', () => {
222 expectTranslate('class X { x(a, b); }').to.equal(`@JS()
223 class X {
224 // @Ignore
225 X.fakeConstructor$();
226 external x(a, b);
227 }`);
228 });
229 it('supports method return types', () => {
230 expectTranslate('class X { x( a : number, b : string ) : num }').to.equal( `@JS()
231 class X {
232 // @Ignore
233 X.fakeConstructor$();
234 external num x(num a, String b);
235 }`);
236 });
237 it('supports get methods', () => {
238 expectTranslate('class X { get y(): number {} }').to.equal(`@JS()
239 class X {
240 // @Ignore
241 X.fakeConstructor$();
242 external num get y;
243 }`);
244 expectTranslate('class X { static get Y(): number {} }').to.equal(`@JS()
245 class X {
246 // @Ignore
247 X.fakeConstructor$();
248 external static num get Y;
249 }`);
250 });
251 it('supports set methods', () => {
252 expectTranslate('class X { set y(n: number) {} }').to.equal(`@JS()
253 class X {
254 // @Ignore
255 X.fakeConstructor$();
256 external set y(num n);
257 }`);
258 expectTranslate('class X { static get Y(): number {} }').to.equal(`@JS()
259 class X {
260 // @Ignore
261 X.fakeConstructor$();
262 external static num get Y;
263 }`);
264 });
265 it('supports generic methods', () => {
266 expectTranslate('class X<T> { static Z<T>(): X<T> {} }').to.equal(`@JS()
267 class X<T> {
268 // @Ignore
269 X.fakeConstructor$();
270 external static X<dynamic/*=T*/ > Z/*< T >*/();
271 }`);
272 expectTranslate('class X<T> { Z(): X<T> {} }').to.equal(`@JS()
273 class X<T> {
274 // @Ignore
275 X.fakeConstructor$();
276 external X<T> Z();
277 }`);
278 });
279 it('merge overrides', () => {
280 expectTranslate(`
281 class X {
282 createElement(tagName: "img"): HTMLImageElement;
283 createElement(tagName: "video"): HTMLVideoElement;
284 createElement(tagName: string): HTMLElement;
285 }`).to.equal(`import "dart:html";
286
287 @JS()
288 class X {
289 // @Ignore
290 X.fakeConstructor$();
291 /* external ImageElement createElement(String /*"img"*/ tagName); */
292 /* external VideoElement createElement(String /*"video"*/ tagName); */
293 /* external HtmlElement createElement(String tagName); */
294 external dynamic /*ImageElement|VideoElement|HtmlElement*/ createElement(
295 String tagName);
296 }`);
297 expectTranslate(`
298 class X {
299 F(a:string):num;
300 F(a:string, b: string|num):string;
301 F(a2:string, b: string, c: num):string;
302 }`).to.equal(`@JS()
303 class X {
304 // @Ignore
305 X.fakeConstructor$();
306 /* external num F(String a); */
307 /* external String F(String a, dynamic /*String|num*/ b); */
308 /* external String F(String a2, String b, num c); */
309 external dynamic /*num|String*/ F(String a_a2,
310 [dynamic /*String|num*/ b, num c]);
311 }`);
312
313 expectTranslate(`
314 class X {
315 Y(a:string):num {};
316 Y(a:string, b: num):string {};
317 Y(a2:string, b: string, c: num):string {};
318 }`).to.equal(`@JS()
319 class X {
320 // @Ignore
321 X.fakeConstructor$();
322 /* external num Y(String a); */
323 /* external String Y(String a, num b); */
324 /* external String Y(String a2, String b, num c); */
325 external dynamic /*num|String*/ Y(String a_a2,
326 [dynamic /*num|String*/ b, num c]);
327 }`);
328 expectTranslate(`
329 class X {
330 firstElement(elements: HTMLImageElement[]): HTMLImageElement;
331 firstElement(elements: HTMLVideoElement[]): HTMLVideoElement;
332 firstElement(elements: HTMLElement[]): HTMLElement;
333 }`).to.equal(`import "dart:html";
334
335 @JS()
336 class X {
337 // @Ignore
338 X.fakeConstructor$();
339 /* external ImageElement firstElement(List<ImageElement> elements); */
340 /* external VideoElement firstElement(List<VideoElement> elements); */
341 /* external HtmlElement firstElement(List<HtmlElement> elements); */
342 external dynamic /*ImageElement|VideoElement|HtmlElement*/ firstElement(
343 List<
344 HtmlElement> /*List<ImageElement>|List<VideoElement>|List<HtmlElement> */ elements);
345 }`);
346
347 // TODO(jacobr): we should consider special casing so EventLister and
348 // EventListenerObject are treated as the same in Dart even though they
349 // are different.
350 expectTranslate(`
351 interface SampleAudioNode {
352 addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boo lean): void;
353 addEventListener(type: string, listener: EventListenerOrEventListenerObject, u seCapture?: boolean): void;
354 }`).to.equal(`import "dart:html";
355 import "package:func/func.dart";
356
357 @anonymous
358 @JS()
359 abstract class SampleAudioNode {
360 /* external void addEventListener(
361 String /*"ended"*/ type, dynamic listener(Event ev),
362 [bool useCapture]); */
363 /* external void addEventListener(
364 String type, dynamic /*EventListener|EventListenerObject*/ listener,
365 [bool useCapture]); */
366 external void addEventListener(String type,
367 dynamic /*Func1<Event, dynamic>|EventListener|EventListenerObject*/ listen er,
368 [bool useCapture]);
369 }`);
370
371 expectTranslate(`
372 interface ListenObject {
373 someDummyMethod(evt: string): void;
374 }
375
376 interface ExampleListener {
377 (evt: string): void;
378 }
379
380 interface DummySample {
381 addEventListener(type: "ended", listener: ListenObject): void;
382 addEventListener(type: string, listener: ExampleListener): void;
383 }`).to.equal(`@anonymous
384 @JS()
385 abstract class ListenObject {
386 external void someDummyMethod(String evt);
387 }
388
389 typedef void ExampleListener(String evt);
390
391 @anonymous
392 @JS()
393 abstract class DummySample {
394 /* external void addEventListener(String /*"ended"*/ type, ListenObject listen er); */
395 /* external void addEventListener(String type, ExampleListener listener); */
396 external void addEventListener(
397 String type, dynamic /*ListenObject|ExampleListener*/ listener);
398 }`);
399
400 expectTranslate(`
401 interface ListenAny {
402 (evt: any): void;
403 }
404
405 interface ExampleListener {
406 (evt: string): void;
407 }
408
409 interface DummySample {
410 addEventListener(type: "ended", listener: ListenAny): void;
411 addEventListener(type: string, listener: ExampleListener): void;
412 }`).to.equal(`typedef void ListenAny(dynamic evt);
413 typedef void ExampleListener(String evt);
414
415 @anonymous
416 @JS()
417 abstract class DummySample {
418 /* external void addEventListener(String /*"ended"*/ type, ListenAny listener) ; */
419 /* external void addEventListener(String type, ExampleListener listener); */
420 external void addEventListener(
421 String type, Function /*ListenAny|ExampleListener*/ listener);
422 }`);
423
424 });
425 it('dot dot dot', () => {
426 expectTranslate(`
427 function buildName(firstName: string, ...restOfName: string[]): string;
428 `).to.equal(`@JS()
429 external String buildName(String firstName,
430 [String restOfName1,
431 String restOfName2,
432 String restOfName3,
433 String restOfName4,
434 String restOfName5]);`);
435 expectTranslate(`
436 function log(...args);`)
437 .to.equal(`@JS()
438 external log([args1, args2, args3, args4, args5]);`);
439 });
440 it('interface constructors', () => {
441 expectTranslate(`
442 interface C {
443 oncached: (ev: Event) => any;
444 }
445 declare var C: {new(): C; CHECKING: number; }`)
446 .to.equal(`import "package:func/func.dart";
447 import "dart:html";
448
449 @JS()
450 abstract class C {
451 external Func1<Event, dynamic> get oncached;
452 external set oncached(Func1<Event, dynamic> v);
453 external factory C();
454 external static num get CHECKING;
455 external static set CHECKING(num v);
456 }`);
457 });
458 it('property bag interfaces', () => {
459 expectTranslate(`
460 interface X {
461 a: string;
462 b: num;
463 c: X;
464 }
465 interface Y extends X {
466 d: num;
467 /* example comment */
468 e: any;
469 }`).to.equal(`@anonymous
470 @JS()
471 abstract class X {
472 external String get a;
473 external set a(String v);
474 external num get b;
475 external set b(num v);
476 external X get c;
477 external set c(X v);
478 external factory X({String a, num b, X c});
479 }
480
481 @anonymous
482 @JS()
483 abstract class Y implements X {
484 external num get d;
485 external set d(num v);
486 /* example comment */
487 external dynamic get e;
488 external set e(dynamic v);
489 external factory Y({num d, dynamic e, String a, num b, X c});
490 }`);
491 expectTranslate(`interface X<A> { a: A; b: num, c: X }
492 interface Y<A,B> extends X<A> { d: B; e: any; }`)
493 .to.equal(`@anonymous
494 @JS()
495 abstract class X<A> {
496 external A get a;
497 external set a(A v);
498 external num get b;
499 external set b(num v);
500 external X get c;
501 external set c(X v);
502 external factory X({A a, num b, X c});
503 }
504
505 @anonymous
506 @JS()
507 abstract class Y<A, B> implements X<A> {
508 external B get d;
509 external set d(B v);
510 external dynamic get e;
511 external set e(dynamic v);
512 external factory Y({B d, dynamic e, A a, num b, X c});
513 }`);
514 });
515 it('callable', () => {
516 expectTranslate('interface X<T> { (a:T):T; Y():T; }').to.equal(`@anonymous
517 @JS()
518 abstract class X<T> implements Function {
519 external T call(T a);
520 external T Y();
521 }`);
522 });
523
524 it('supports constructors', () => {
525 expectTranslate('class X { constructor() { } }').to.equal(`@JS()
526 class X {
527 // @Ignore
528 X.fakeConstructor$();
529 external factory X();
530 }`);
531 });
532 it('supports parameter properties', () => {
533 expectTranslate(`
534 class X {
535 c: number;
536 constructor(private _bar: B, public foo: string = "hello", private _goggles: b oolean = true);
537 }`).to.equal(`@JS()
538 class X {
539 // @Ignore
540 X.fakeConstructor$();
541 external B get JS$_bar;
542 external set JS$_bar(B v);
543 external String get foo;
544 external set foo(String v);
545 external bool get JS$_goggles;
546 external set JS$_goggles(bool v);
547 external num get c;
548 external set c(num v);
549 external factory X(B JS$_bar, [String foo, bool JS$_goggles]);
550 }`);
551 expectTranslate(`
552 class X {
553 constructor(public foo: string, b: number, private _marbles: boolean = true) { }
554 }`).to.equal(`@JS()
555 class X {
556 // @Ignore
557 X.fakeConstructor$();
558 external String get foo;
559 external set foo(String v);
560 external bool get JS$_marbles;
561 external set JS$_marbles(bool v);
562 external factory X(String foo, num b, [bool JS$_marbles]);
563 }`);
564 });
565 });
566 });
567
568 describe('interfaces', () => {
569 it('translates interfaces to abstract classes', () => {
570 expectTranslate('interface X {}').to.equal(`@anonymous
571 @JS()
572 abstract class X {}`);
573 });
574 it('translates interface extends to class implements', () => {
575 expectTranslate('interface X extends Y, Z {}').to.equal(`@anonymous
576 @JS()
577 abstract class X implements Y, Z {}`);
578 });
579 it('supports abstract methods', () => {
580 expectTranslate('interface X { x(); }').to.equal(`@anonymous
581 @JS()
582 abstract class X {
583 external x();
584 }`);
585 });
586
587 it('supports interface properties', () => {
588 expectTranslate('interface X { x: string; y; }').to.equal(`@anonymous
589 @JS()
590 abstract class X {
591 external String get x;
592 external set x(String v);
593 external get y;
594 external set y(v);
595 external factory X({String x, y});
596 }`);
597 });
598 });
599
600 describe('single call signature interfaces', () => {
601 it('should support declaration', () => {
602 expectTranslate('interface F { (n: number): boolean; }').to.equal('typedef b ool F(num n);');
603 });
604 it('should support generics', () => {
605 expectTranslate('interface F<A, B> { (a: A): B; }').to.equal('typedef B F<A, B>(A a);');
606 });
607 });
608
609 describe('enums', () => {
610 it('should support basic enum declaration', () => {
611 expectTranslate('enum Color { Red, Green, Blue }').to.equal(`@JS()
612 class Color {
613 external static num get Red;
614 external static num get Green;
615 external static num get Blue;
616 }`);
617 });
618 it('empty enum', () => {
619 expectTranslate('enum Color { }').to.equal(`@JS()
620 class Color {}`);
621 });
622 it('enum with initializer', () => {
623 expectTranslate('enum Color { Red = 1, Green, Blue = 4 }').to.equal(`@JS()
624 class Color {
625 external static num get Red;
626 external static num get Green;
627 external static num get Blue;
628 }`);
629 });
630 });
631
632 describe('renames', () => {
633 it('should support class renames', () => {
634 expectTranslate(`
635 declare module m1 {
636 interface A { x(); }
637 }
638 declare module m2 {
639 interface A { y(); }
640 }
641 `).to.equal(`// Module m1
642 @anonymous
643 @JS()
644 abstract class A {
645 external x();
646 }
647 // End module m1
648
649 // Module m2
650 @anonymous
651 @JS()
652 abstract class m2_A {
653 external y();
654 }
655 // End module m2`);
656 expectTranslate(`
657 declare module m1 {
658 class A { constructor(x); }
659 }
660 declare module m2 {
661 class A { constructor(y); }
662 }`).to.equal(`// Module m1
663 @JS("m1.A")
664 class A {
665 // @Ignore
666 A.fakeConstructor$();
667 external factory A(x);
668 }
669 // End module m1
670
671 // Module m2
672 @JS("m2.A")
673 class m2_A {
674 // @Ignore
675 m2_A.fakeConstructor$();
676 external factory m2_A(y);
677 }
678 // End module m2`);
679 expectTranslate(`
680 declare module m1 {
681 class A { constructor(x:m2.A); }
682 }
683 declare module m2 {
684 class A { constructor(y:m1.A); }
685 }
686 `).to.equal(`// Module m1
687 @JS("m1.A")
688 class A {
689 // @Ignore
690 A.fakeConstructor$();
691 external factory A(m2_A x);
692 }
693 // End module m1
694
695 // Module m2
696 @JS("m2.A")
697 class m2_A {
698 // @Ignore
699 m2_A.fakeConstructor$();
700 external factory m2_A(A y);
701 }
702 // End module m2`);
703
704 });
705 it('should support member renames', () => {
706 expectTranslate(`
707 declare module m1 {
708 interface A { x(); }
709 }
710 declare module m2 {
711 export function A(x:m1.A);
712 }`).to.equal(`// Module m1
713 @anonymous
714 @JS()
715 abstract class A {
716 external x();
717 }
718 // End module m1
719
720 // Module m2
721 @JS("m2.A")
722 external m2_A(A x);
723 // End module m2`);
724 });
725
726 it('handle class renames in type declarations', () => {
727 expectTranslate(`
728 declare module m1 {
729 interface A { x(); }
730 }
731 declare module m2 {
732 interface A { y(); }
733 }
734 export function register(x:m2.A);
735 `).to.equal(`// Module m1
736 @anonymous
737 @JS()
738 abstract class A {
739 external x();
740 }
741 // End module m1
742
743 // Module m2
744 @anonymous
745 @JS()
746 abstract class m2_A {
747 external y();
748 }
749
750 // End module m2
751 @JS()
752 external register(m2_A x);`);
753 expectTranslate(`
754 declare module m1 {
755 module foo {
756 interface A { x(); }
757 }
758 }
759 declare module m2 {
760 module foo {
761 interface A { y(); }
762 }
763 }
764 declare module m3 {
765 module foo {
766 interface A { z(); }
767 }
768 }
769 export function register(y:m2.foo.A, z:m3.foo.A);
770 `).to.equal(`// Module m1
771
772 // Module foo
773 @anonymous
774 @JS()
775 abstract class A {
776 external x();
777 }
778 // End module foo
779
780 // End module m1
781
782 // Module m2
783
784 // Module foo
785 @anonymous
786 @JS()
787 abstract class foo_A {
788 external y();
789 }
790 // End module foo
791
792 // End module m2
793
794 // Module m3
795
796 // Module foo
797 @anonymous
798 @JS()
799 abstract class m3_foo_A {
800 external z();
801 }
802 // End module foo
803
804 // End module m3
805 @JS()
806 external register(foo_A y, m3_foo_A z);`);
807
808 expectTranslate(`
809 declare module m1 {
810 interface A { x(); }
811 }
812 declare module m2 {
813 interface A { y(); }
814 }
815 export function register(x:m1.A);
816 `).to.equal(`// Module m1
817 @anonymous
818 @JS()
819 abstract class A {
820 external x();
821 }
822 // End module m1
823
824 // Module m2
825 @anonymous
826 @JS()
827 abstract class m2_A {
828 external y();
829 }
830
831 // End module m2
832 @JS()
833 external register(A x);`);
834 });
835
836 describe('type alias', () => {
837 it('replace with simple type', () => {
838 expectTranslate(`
839 type MyNumber = number;
840 export function add(x: MyNumber, y: MyNumber): MyNumber;
841 `).to.equal(`@JS()
842 external num add(num x, num y);`);
843 });
844 });
845
846 it('union types', () => {
847 expectTranslate(`
848 type listener1 = ()=>boolean;
849 type listener2 = (e:string)=>boolean;
850 function addEventListener(listener: listener1|listener2);`)
851 .to.equal(`import "package:func/func.dart";
852
853 @JS()
854 external addEventListener(
855 Function /*Func0<bool>|Func1<String, bool>*/ listener);`);
856
857 expectTranslate('function draw(el: HTMLCanvasElement|HTMLImageElement):void; ')
858 .to.equal(`import "dart:html";
859
860 @JS()
861 external void draw(HtmlElement /*CanvasElement|ImageElement*/ el);`);
862 });
863 });
OLDNEW
« package.json ('K') | « test/function_test.ts ('k') | test/literal_test.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698