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

Side by Side Diff: pkg/polymer/example/component/news/test/news_index_test.dart

Issue 225043004: Replace bootstrap logic with 'boot.js', use 'component/dart' mime-type and add (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
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 import 'dart:html'; 5 import 'dart:html';
6 import 'package:polymer/polymer.dart'; 6 import 'package:polymer/polymer.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
9 9
10 /// This test runs the news example and checks the state of the initial page. 10 /// This test runs the news example and checks the state of the initial page.
11 @initMethod
11 main() { 12 main() {
12 initPolymer();
13 useHtmlConfiguration(); 13 useHtmlConfiguration();
14 14
15 extractLinks(nodes) => nodes.where((n) => n is Element) 15 extractLinks(nodes) => nodes.where((n) => n is Element)
16 .map((n) => n.query('a').href.split('/').last).toList(); 16 .map((n) => n.query('a').href.split('/').last).toList();
17 17
18 test('initial state', () { 18 test('initial state', () {
19 final listComp = querySelector('ul'); 19 final listComp = querySelector('ul');
20 final items = listComp.querySelectorAll('li'); 20 final items = listComp.querySelectorAll('li');
21 expect(items.length, 6); 21 expect(items.length, 6);
22 expect(extractLinks(items), ['1', '2', '3', '4', '4', '5']); 22 expect(extractLinks(items), ['1', '2', '3', '4', '4', '5']);
23 expect(listComp is Polymer, true, reason: 'x-news should be created'); 23 expect(listComp is Polymer, true, reason: 'x-news should be created');
24 24
25 final contents = listComp.shadowRoot.querySelectorAll('content'); 25 final contents = listComp.shadowRoot.querySelectorAll('content');
26 expect(contents.length, 2, reason: 'news has 2 content tags'); 26 expect(contents.length, 2, reason: 'news has 2 content tags');
27 expect(extractLinks(contents[0].getDistributedNodes()), 27 expect(extractLinks(contents[0].getDistributedNodes()),
28 ['3', '5'], reason: 'breaking stories first'); 28 ['3', '5'], reason: 'breaking stories first');
29 expect(extractLinks(contents[1].getDistributedNodes()), 29 expect(extractLinks(contents[1].getDistributedNodes()),
30 ['1', '2', '4', '4'], reason: 'other stories after breaking stories'); 30 ['1', '2', '4', '4'], reason: 'other stories after breaking stories');
31 }); 31 });
32 } 32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698