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

Side by Side Diff: packages/js_util/test/js_util_test.dart

Issue 2312183003: Removed Polymer from Observatory deps (Closed)
Patch Set: Created 4 years, 3 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 | « packages/js_util/pubspec.yaml ('k') | packages/js_util/test/js_util_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 @JS()
2 library js_util.test;
3
4 import 'package:js/js.dart';
5 import 'package:js_util/js_util.dart';
6 import 'package:test/test.dart';
7
8 @JS('JSON.stringify')
9 external String stringify(Object json);
10
11 void main() {
12 group('js_util tests', () {
13 test('defineProperty test', () {
14 final obj = newObject();
15 defineProperty(
16 obj, 'foo', new PropertyDescription(enumerable: true, value: 1));
17 defineProperty(
18 obj, 'bar', new PropertyDescription(enumerable: false, value: 2));
19
20 expect(stringify(obj), '{"foo":1}');
21 });
22
23 test('newObject/setValue/getValue test', () {
24 final obj = newObject();
25 setValue(obj, 'foo', 1);
26 setValue(obj, 'bar', 2);
27
28 expect(getValue(obj, 'foo'), equals(1));
29 expect(getValue(obj, 'bar'), equals(2));
30 });
31
32 test('toJS test', () {
33 final jsObj = toJS({
34 'people': [
35 {'firstName': 'Kwang Yul', 'lastName': 'Seo'},
36 {'firstName': 'DoHyung', 'lastName': 'Kim'},
37 {'firstName': 'Kyusun', 'lastName': 'Kim'}
38 ]
39 });
40
41 final people = getValue(jsObj, 'people');
42 expect(getValue(people[0], 'firstName'), equals('Kwang Yul'));
43 expect(getValue(people[0], 'lastName'), equals('Seo'));
44 expect(getValue(people[1], 'firstName'), equals('DoHyung'));
45 expect(getValue(people[1], 'lastName'), equals('Kim'));
46 expect(getValue(people[2], 'firstName'), equals('Kyusun'));
47 expect(getValue(people[2], 'lastName'), equals('Kim'));
48 });
49 });
50 }
OLDNEW
« no previous file with comments | « packages/js_util/pubspec.yaml ('k') | packages/js_util/test/js_util_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698