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

Side by Side Diff: test/iron_selector_content_test.dart

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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 | « test/iron_selector_basic_test.dart ('k') | test/iron_selector_exclude_local_names_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 @TestOn('browser') 4 @TestOn('browser')
5 library polymer_elements.test.iron_selector_content_test; 5 library polymer_elements.test.iron_selector_content_test;
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 import 'package:polymer_elements/iron_selector.dart'; 10 import 'package:polymer_elements/iron_selector.dart';
11 import 'package:polymer_interop/polymer_interop.dart'; 11 import 'package:polymer_interop/polymer_interop.dart';
12 import 'package:polymer/polymer.dart';
12 import 'package:test/test.dart'; 13 import 'package:test/test.dart';
13 import 'package:web_components/web_components.dart'; 14 import 'package:web_components/web_components.dart';
14 import 'common.dart'; 15 import 'common.dart';
15 import 'fixtures/content_element.dart'; 16 import 'fixtures/content_element.dart';
16 17
17 /// Used imports: [IronSelector] 18 /// Used imports: [IronSelector]
18 main() async { 19 main() async {
19 await initWebComponents(); 20 await initPolymer();
20 21
21 TestContentElement s1 = document.querySelector('#selector1'); 22 TestContentElement s1 = document.querySelector('#selector1');
22 TestContentElement s2 = document.querySelector('#selector2'); 23 TestContentElement s2 = document.querySelector('#selector2');
23 TestContentElement s3 = document.querySelector('#selector3'); 24 TestContentElement s3 = document.querySelector('#selector3');
24 25
25 // TODO(jakemac): Remove JsObject conversion once 26 DomRepeat t = document.querySelector('#t');
26 // https://github.com/dart-lang/polymer_interop/issues/7 is implemented.
27 var t = new JsObject.fromBrowserObject(document.querySelector('#t'));
28 27
29 group('content', () { 28 group('content', () {
30 test('attribute selected', () { 29 test('attribute selected', () {
31 // check selected class 30 // check selected class
32 expect( 31 expect(
33 s1.querySelector('#item0').classes.contains('iron-selected'), isTrue); 32 s1.querySelector('#item0').classes.contains('iron-selected'), isTrue);
34 }); 33 });
35 34
36 test('set selected', () { 35 test('set selected', () {
37 // set selected 36 // set selected
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 expect(s2.$['selector'].items.length, 5); 105 expect(s2.$['selector'].items.length, 5);
107 // check selected class 106 // check selected class
108 expect( 107 expect(
109 s2.querySelector('#item4').classes.contains('iron-selected'), isTrue); 108 s2.querySelector('#item4').classes.contains('iron-selected'), isTrue);
110 }); 109 });
111 }); 110 });
112 111
113 group('content with dom-repeat', () { 112 group('content with dom-repeat', () {
114 test('supports repeated children', () { 113 test('supports repeated children', () {
115 var done = new Completer(); 114 var done = new Completer();
116 t['items'] = new JsObject.jsify([ 115 t.items = [
117 {'name': 'item0'}, 116 {'name': 'item0'},
118 {'name': 'item1'}, 117 {'name': 'item1'},
119 {'name': 'item2'}, 118 {'name': 'item2'},
120 {'name': 'item3'} 119 {'name': 'item3'}
121 ]); 120 ];
122 wait(1).then((_) { 121 wait(1).then((_) {
123 // check selected 122 // check selected
124 expect(s3.selected, 'item0'); 123 expect(s3.selected, 'item0');
125 // check selected class 124 // check selected class
126 expect(s3.querySelector('#item0').classes.contains('iron-selected'), 125 expect(s3.querySelector('#item0').classes.contains('iron-selected'),
127 isTrue); 126 isTrue);
128 // set selected 127 // set selected
129 s3.selected = 'item2'; 128 s3.selected = 'item2';
130 // check selected class 129 // check selected class
131 expect(s3.querySelector('#item2').classes.contains('iron-selected'), 130 expect(s3.querySelector('#item2').classes.contains('iron-selected'),
132 isTrue); 131 isTrue);
133 done.complete(); 132 done.complete();
134 }); 133 });
135 134
136 return done.future; 135 return done.future;
137 }); 136 });
138 }); 137 });
139 } 138 }
OLDNEW
« no previous file with comments | « test/iron_selector_basic_test.dart ('k') | test/iron_selector_exclude_local_names_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698