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

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

Issue 1410403003: Switch Js to JS (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « sdk/lib/js/dartium/js_dartium.dart ('k') | tests/html/js_dart_to_string_test.dart » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @Js("ArrayTest.Util") 5 @JS("ArrayTest.Util")
6 library js_array_test; 6 library js_array_test;
7 7
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 import 'dart:js' as js; 10 import 'dart:js' as js;
11 import 'package:js/js.dart'; 11 import 'package:js/js.dart';
12 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
13 import 'package:unittest/html_config.dart'; 13 import 'package:unittest/html_config.dart';
14 import 'json_helper.dart' as json_helper; 14 import 'json_helper.dart' as json_helper;
15 15
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 }, 152 },
153 153
154 newArray: function() { return []; }, 154 newArray: function() { return []; },
155 155
156 newLiteral: function() { return {}; }, 156 newLiteral: function() { return {}; },
157 157
158 }; 158 };
159 """); 159 """);
160 } 160 }
161 161
162 @Js() 162 @JS()
163 class PropertyDescriptor { 163 class PropertyDescriptor {
164 external get value; 164 external get value;
165 external bool get writable; 165 external bool get writable;
166 external bool get enumerable; 166 external bool get enumerable;
167 external bool get configurable; 167 external bool get configurable;
168 } 168 }
169 169
170 @Js() 170 @JS()
171 class SimpleJsLiteralClass { 171 class SimpleJsLiteralClass {
172 external get foo; 172 external get foo;
173 } 173 }
174 174
175 class Foo {} 175 class Foo {}
176 176
177 @Js() 177 @JS()
178 external callJsMethod(List array, String methodName, List args); 178 external callJsMethod(List array, String methodName, List args);
179 179
180 callIndexOf(List array, value) => callJsMethod(array, "indexOf", [value]); 180 callIndexOf(List array, value) => callJsMethod(array, "indexOf", [value]);
181 callLastIndexOf(List array, value) => 181 callLastIndexOf(List array, value) =>
182 callJsMethod(array, "lastIndexOf", [value]); 182 callJsMethod(array, "lastIndexOf", [value]);
183 183
184 callPop(List array) => callJsMethod(array, "pop", []); 184 callPop(List array) => callJsMethod(array, "pop", []);
185 callPush(List array, element) => callJsMethod(array, "push", [element]); 185 callPush(List array, element) => callJsMethod(array, "push", [element]);
186 callShift(List array) => callJsMethod(array, "shift", []); 186 callShift(List array) => callJsMethod(array, "shift", []);
187 callReverse(List array) => callJsMethod(array, "reverse", []); 187 callReverse(List array) => callJsMethod(array, "reverse", []);
188 188
189 callListMethodOnObject(object, String methodName, List args) => 189 callListMethodOnObject(object, String methodName, List args) =>
190 callListMethodOnTarget([], object, methodName, args); 190 callListMethodOnTarget([], object, methodName, args);
191 191
192 @Js() 192 @JS()
193 external jsEnumerateIndices(obj); 193 external jsEnumerateIndices(obj);
194 @Js() 194 @JS()
195 external bool checkIsArray(obj); 195 external bool checkIsArray(obj);
196 @Js() 196 @JS()
197 external concatValues(obj); 197 external concatValues(obj);
198 198
199 @Js() 199 @JS()
200 external concatOntoArray(obj); 200 external concatOntoArray(obj);
201 201
202 @Js() 202 @JS()
203 external repeatedConcatOntoArray(obj); 203 external repeatedConcatOntoArray(obj);
204 @Js() 204 @JS()
205 external bool everyGreaterThanZero(obj); 205 external bool everyGreaterThanZero(obj);
206 @Js() 206 @JS()
207 external bool everyGreaterThanZeroCheckThisArg(obj); 207 external bool everyGreaterThanZeroCheckThisArg(obj);
208 208
209 @Js() 209 @JS()
210 external filterGreater42(obj); 210 external filterGreater42(obj);
211 211
212 @Js() 212 @JS()
213 external forEachCollectResult(List array); 213 external forEachCollectResult(List array);
214 @Js() 214 @JS()
215 external someEqual42(List array); 215 external someEqual42(List array);
216 @Js() 216 @JS()
217 external sortNumbersBackwards(List array); 217 external sortNumbersBackwards(List array);
218 218
219 @Js() 219 @JS()
220 external List spliceDummyItems(List array); 220 external List spliceDummyItems(List array);
221 221
222 @Js() 222 @JS()
223 external List spliceTestStringArgs(List array); 223 external List spliceTestStringArgs(List array);
224 224
225 @Js() 225 @JS()
226 external List splicePastEnd(List array); 226 external List splicePastEnd(List array);
227 227
228 @Js() 228 @JS()
229 external String callJsToString(List array); 229 external String callJsToString(List array);
230 230
231 @Js() 231 @JS()
232 external mapAddIndexToEachElement(List array); 232 external mapAddIndexToEachElement(List array);
233 @Js() 233 @JS()
234 external reduceSumDoubledElements(List array); 234 external reduceSumDoubledElements(List array);
235 235
236 // TODO(jacobr): add a test that distinguishes reduce from reduceRight. 236 // TODO(jacobr): add a test that distinguishes reduce from reduceRight.
237 @Js() 237 @JS()
238 external reduceRightSumDoubledElements(List array); 238 external reduceRightSumDoubledElements(List array);
239 239
240 @Js() 240 @JS()
241 external PropertyDescriptor getOwnPropertyDescriptor(obj, property); 241 external PropertyDescriptor getOwnPropertyDescriptor(obj, property);
242 242
243 @Js("setLength") 243 @JS("setLength")
244 external callSetLength(List array, length); 244 external callSetLength(List array, length);
245 245
246 @Js() 246 @JS()
247 external getValue(obj, index); 247 external getValue(obj, index);
248 248
249 @Js() 249 @JS()
250 external setValue(obj, index, value); 250 external setValue(obj, index, value);
251 251
252 @Js() 252 @JS()
253 external callListMethodOnTarget(List target, object, String methodName, List arg s); 253 external callListMethodOnTarget(List target, object, String methodName, List arg s);
254 254
255 @Js() 255 @JS()
256 external newArray(); 256 external newArray();
257 257
258 @Js() 258 @JS()
259 external newLiteral(); 259 external newLiteral();
260 260
261 main() { 261 main() {
262 _injectJs(); 262 _injectJs();
263 useHtmlConfiguration(); 263 useHtmlConfiguration();
264 264
265 group('indexOf', () { 265 group('indexOf', () {
266 var div = new DivElement(); 266 var div = new DivElement();
267 var list = [3, 42, "foo", 42, div]; 267 var list = [3, 42, "foo", 42, div];
268 test('found', () { 268 test('found', () {
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 expect(listView is List, isTrue); 687 expect(listView is List, isTrue);
688 expect(listView.length, equals(2)); 688 expect(listView.length, equals(2));
689 expect(checkIsArray(listView), isFalse); 689 expect(checkIsArray(listView), isFalse);
690 expect(checkIsArray(listView.toList()), isTrue); 690 expect(checkIsArray(listView.toList()), isTrue);
691 expect(getOwnPropertyDescriptor( 691 expect(getOwnPropertyDescriptor(
692 listView, "length"), equals(null)); 692 listView, "length"), equals(null));
693 }); 693 });
694 }); 694 });
695 */ 695 */
696 } 696 }
OLDNEW
« no previous file with comments | « sdk/lib/js/dartium/js_dartium.dart ('k') | tests/html/js_dart_to_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698