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

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

Issue 2110273003: Make is checks work on JavaScriptFunction objects. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 jsTest; 5 library jsTest;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:typed_data' show ByteBuffer, Int32List; 9 import 'dart:typed_data' show ByteBuffer, Int32List;
10 import 'dart:indexed_db' show IdbFactory, KeyRange; 10 import 'dart:indexed_db' show IdbFactory, KeyRange;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 var someProto = { role: "proto" }; 189 var someProto = { role: "proto" };
190 var someObject = Object.create(someProto); 190 var someObject = Object.create(someProto);
191 someObject.role = "object"; 191 someObject.role = "object";
192 192
193 """; 193 """;
194 document.body.append(script); 194 document.body.append(script);
195 } 195 }
196 196
197 typedef bool StringToBool(String s);
198
197 // Some test are either causing other test to fail in IE9, or they are failing 199 // Some test are either causing other test to fail in IE9, or they are failing
198 // for unknown reasons 200 // for unknown reasons
199 // useHtmlConfiguration+ImageData bug: dartbug.com/14355 201 // useHtmlConfiguration+ImageData bug: dartbug.com/14355
200 skipIE9_test(String description, t()) { 202 skipIE9_test(String description, t()) {
201 if (Platform.supportsTypedData) { 203 if (Platform.supportsTypedData) {
202 test(description, t); 204 test(description, t);
203 } 205 }
204 } 206 }
205 207
206 class Foo { 208 class Foo {
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 if (Platform.supportsTypedData) { 917 if (Platform.supportsTypedData) {
916 var list = context.callMethod('getNewInt32Array'); 918 var list = context.callMethod('getNewInt32Array');
917 print(list); 919 print(list);
918 expect(list is Int32List, isTrue); 920 expect(list is Int32List, isTrue);
919 expect(list, orderedEquals([1, 2, 3, 4, 5, 6, 7, 8])); 921 expect(list, orderedEquals([1, 2, 3, 4, 5, 6, 7, 8]));
920 } 922 }
921 }); 923 });
922 924
923 }); 925 });
924 926
927 group('JavaScriptFunction', () {
928 test('is check', () {
929 var fn = (String s) => true;
930 var jsFn = allowInterop(fn);
931 expect(fn is StringToBool, isTrue);
932 expect(jsFn is StringToBool, isTrue);
933 expect(jsFn is Function, isTrue);
934 expect(jsFn is List, isFalse);
935 });
936 });
937
925 group('Dart->JS', () { 938 group('Dart->JS', () {
926 939
927 test('Date', () { 940 test('Date', () {
928 context['o'] = new DateTime(1995, 12, 17); 941 context['o'] = new DateTime(1995, 12, 17);
929 var dateType = context['Date']; 942 var dateType = context['Date'];
930 expect(context.callMethod('isPropertyInstanceOf', ['o', dateType]), 943 expect(context.callMethod('isPropertyInstanceOf', ['o', dateType]),
931 isTrue); 944 isTrue);
932 context.deleteProperty('o'); 945 context.deleteProperty('o');
933 }); 946 });
934 947
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), 1018 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]),
1006 // isTrue); 1019 // isTrue);
1007 context.deleteProperty('o'); 1020 context.deleteProperty('o');
1008 } 1021 }
1009 }); 1022 });
1010 1023
1011 }); 1024 });
1012 }); 1025 });
1013 1026
1014 } 1027 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698