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

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

Issue 19235003: Fix dart:js test for IE (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/html/html.status ('k') | no next file » | 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) 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:js'; 9 import 'dart:js';
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 function returnElement(element) { 84 function returnElement(element) {
85 return element; 85 return element;
86 } 86 }
87 87
88 function getElementAttribute(element, attr) { 88 function getElementAttribute(element, attr) {
89 return element.getAttribute(attr); 89 return element.getAttribute(attr);
90 } 90 }
91 91
92 function addClassAttributes(list) { 92 function addClassAttributes(list) {
93 var result = ""; 93 var result = "";
94 for (var i=0; i<list.length; i++) { 94 for (var i=0; i < list.length; i++) {
vsm 2013/07/15 22:42:21 The lack of spacing seems to break IE for some rea
95 result += list[i].getAttribute("class"); 95 result += list[i].getAttribute("class");
96 } 96 }
97 return result; 97 return result;
98 } 98 }
99 99
100 function getNewDivElement() { 100 function getNewDivElement() {
101 return document.createElement("div"); 101 return document.createElement("div");
102 } 102 }
103 103
104 function testJsMap(callback) { 104 function testJsMap(callback) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 test('js instantiation : new Date()', () { 193 test('js instantiation : new Date()', () {
194 final a = new JsObject(context['Date']); 194 final a = new JsObject(context['Date']);
195 expect(a.callMethod('getTime'), isNotNull); 195 expect(a.callMethod('getTime'), isNotNull);
196 }); 196 });
197 197
198 test('js instantiation : new Date(12345678)', () { 198 test('js instantiation : new Date(12345678)', () {
199 final a = new JsObject(context['Date'], [12345678]); 199 final a = new JsObject(context['Date'], [12345678]);
200 expect(a.callMethod('getTime'), equals(12345678)); 200 expect(a.callMethod('getTime'), equals(12345678));
201 }); 201 });
202 202
203 test('js instantiation : new Date("December 17, 1995 03:24:00 GMT+01:00")', 203 test('js instantiation : new Date("December 17, 1995 03:24:00 GMT")',
vsm 2013/07/15 22:42:21 IE9 doesn't understand the +01:00 syntax. This is
204 () { 204 () {
205 final a = new JsObject(context['Date'], 205 final a = new JsObject(context['Date'],
206 ["December 17, 1995 03:24:00 GMT+01:00"]); 206 ["December 17, 1995 03:24:00 GMT"]);
207 expect(a.callMethod('getTime'), equals(819167040000)); 207 expect(a.callMethod('getTime'), equals(819170640000));
208 }); 208 });
209 209
210 test('js instantiation : new Date(1995,11,17)', () { 210 test('js instantiation : new Date(1995,11,17)', () {
211 // Note: JS Date counts months from 0 while Dart counts from 1. 211 // Note: JS Date counts months from 0 while Dart counts from 1.
212 final a = new JsObject(context['Date'], [1995, 11, 17]); 212 final a = new JsObject(context['Date'], [1995, 11, 17]);
213 final b = new DateTime(1995, 12, 17); 213 final b = new DateTime(1995, 12, 17);
214 expect(a.callMethod('getTime'), equals(b.millisecondsSinceEpoch)); 214 expect(a.callMethod('getTime'), equals(b.millisecondsSinceEpoch));
215 }); 215 });
216 216
217 test('js instantiation : new Date(1995,11,17,3,24,0)', () { 217 test('js instantiation : new Date(1995,11,17,3,24,0)', () {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 a['pop'].apply(a); 249 a['pop'].apply(a);
250 expect(a['length'], equals(0)); 250 expect(a['length'], equals(0));
251 }); 251 });
252 252
253 test('js instantiation via map notation : new Date()', () { 253 test('js instantiation via map notation : new Date()', () {
254 final a = new JsObject(context['Date']); 254 final a = new JsObject(context['Date']);
255 expect(a['getTime'].apply(a), isNotNull); 255 expect(a['getTime'].apply(a), isNotNull);
256 }); 256 });
257 257
258 test('js instantiation : typed array', () { 258 test('js instantiation : typed array', () {
259 final codeUnits = "test".codeUnits; 259 if (Platform.supportsTypedData) {
vsm 2013/07/15 22:42:21 No typed arrays on IE9 - this skips it.
260 final buf = new JsObject(context['ArrayBuffer'], [codeUnits.length]); 260 final codeUnits = "test".codeUnits;
261 final bufView = new JsObject(context['Uint8Array'], [buf]); 261 final buf = new JsObject(context['ArrayBuffer'], [codeUnits.length]);
262 for (var i = 0; i < codeUnits.length; i++) { 262 final bufView = new JsObject(context['Uint8Array'], [buf]);
263 bufView[i] = codeUnits[i]; 263 for (var i = 0; i < codeUnits.length; i++) {
264 bufView[i] = codeUnits[i];
265 }
264 } 266 }
265 }); 267 });
266 268
267 test('js instantiation : >10 parameters', () { 269 test('js instantiation : >10 parameters', () {
268 final o = new JsObject(context['Baz'], [1,2,3,4,5,6,7,8,9,10,11]); 270 final o = new JsObject(context['Baz'], [1,2,3,4,5,6,7,8,9,10,11]);
269 for (var i = 1; i <= 11; i++) { 271 for (var i = 1; i <= 11; i++) {
270 o["f$i"] = i; 272 o["f$i"] = i;
271 } 273 }
272 }); 274 });
273 275
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 context['dartDate'] = date; 460 context['dartDate'] = date;
459 expect(context['dartDate'], equals(date)); 461 expect(context['dartDate'], equals(date));
460 }); 462 });
461 463
462 test('usage of Serializable', () { 464 test('usage of Serializable', () {
463 final red = Color.RED; 465 final red = Color.RED;
464 context['color'] = red; 466 context['color'] = red;
465 expect(context['color'], equals(red._value)); 467 expect(context['color'], equals(red._value));
466 }); 468 });
467 } 469 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698