OLD | NEW |
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 @JS() | 5 @JS() |
6 library js_native_test; | 6 library js_native_test; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:typed_data' show ByteBuffer, Int32List; | 10 import 'dart:typed_data' show ByteBuffer, Int32List; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 equals(object['b']['d'])); | 168 equals(object['b']['d'])); |
169 expect( | 169 expect( |
170 js_util.callMethod( | 170 js_util.callMethod( |
171 js_util.getProperty(js_util.getProperty(jsObject, 'b'), 'd'), | 171 js_util.getProperty(js_util.getProperty(jsObject, 'b'), 'd'), |
172 'bar', []), | 172 'bar', []), |
173 equals(42)); | 173 equals(42)); |
174 expect(js_util.getProperty(jsObject, 'e'), isNull); | 174 expect(js_util.getProperty(jsObject, 'e'), isNull); |
175 }); | 175 }); |
176 | 176 |
177 test('throws if object is not a Map or Iterable', () { | 177 test('throws if object is not a Map or Iterable', () { |
178 expect(() => js_util.jsify('a'), | 178 expect( |
179 throwsA(new isInstanceOf<ArgumentError>())); | 179 () => js_util.jsify('a'), throwsA(new isInstanceOf<ArgumentError>())); |
180 }); | 180 }); |
181 }); | 181 }); |
182 | 182 |
183 group('js_util.newObject', () { | 183 group('js_util.newObject', () { |
184 test('create', () { | 184 test('create', () { |
185 expect(identical(js_util.newObject(), js_util.newObject()), isFalse); | 185 expect(identical(js_util.newObject(), js_util.newObject()), isFalse); |
186 }); | 186 }); |
187 | 187 |
188 test('callMethod', () { | 188 test('callMethod', () { |
189 var o = js_util.newObject(); | 189 var o = js_util.newObject(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 expect(textNode is Text, isTrue); | 338 expect(textNode is Text, isTrue); |
339 expect(textNode.text, equals('foo')); | 339 expect(textNode.text, equals('foo')); |
340 }); | 340 }); |
341 | 341 |
342 test('typed object', () { | 342 test('typed object', () { |
343 Foo f = js_util.callConstructor(JSFooType, [42]); | 343 Foo f = js_util.callConstructor(JSFooType, [42]); |
344 expect(f.a, equals(42)); | 344 expect(f.a, equals(42)); |
345 }); | 345 }); |
346 }); | 346 }); |
347 } | 347 } |
OLD | NEW |