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

Side by Side Diff: samples-dev/swarm/test/swarm_test.dart

Issue 2828603002: Format samples and samples-dev directories. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library swarm_tests; 5 library swarm_tests;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
(...skipping 15 matching lines...) Expand all
26 // TODO(jmesserly): should be adding the full stylesheet here 26 // TODO(jmesserly): should be adding the full stylesheet here
27 Dom.addStyle(''' 27 Dom.addStyle('''
28 .story-content { 28 .story-content {
29 -webkit-column-width: 300px; 29 -webkit-column-width: 300px;
30 -webkit-column-gap: 26px; /* 2em */ 30 -webkit-column-gap: 26px; /* 2em */
31 }'''); 31 }''');
32 32
33 getStoryNode() => swarm.frontView.storyView.node; 33 getStoryNode() => swarm.frontView.storyView.node;
34 34
35 getView(Section section) { 35 getView(Section section) {
36 return CollectionUtils.find(swarm.frontView.sections.childViews, 36 return CollectionUtils.find(
37 (view) => view.section == section); 37 swarm.frontView.sections.childViews, (view) => view.section == section);
38 } 38 }
39 39
40 getHistory(Article article) { 40 getHistory(Article article) {
41 final feed = article.dataSource; 41 final feed = article.dataSource;
42 return { 42 return {
43 'section': CollectionUtils.find(swarm.sections, 43 'section': CollectionUtils
44 (s) => s.feeds.indexOf(feed, 0) >= 0).id, 44 .find(swarm.sections, (s) => s.feeds.indexOf(feed, 0) >= 0)
45 .id,
45 'feed': feed.id, 46 'feed': feed.id,
46 'article': article.id 47 'article': article.id
47 }; 48 };
48 } 49 }
49 50
50 test('BackButton', () { 51 test('BackButton', () {
51 _serialInvokeAsync([ 52 _serialInvokeAsync([
52 () { 53 () {
53 Expect.equals(null, swarm.frontView.storyView); // verify initial state 54 Expect.equals(null, swarm.frontView.storyView); // verify initial state
54 55
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 }); 107 });
107 } 108 }
108 109
109 /** Triggers the click event, like [http://api.jquery.com/click/] */ 110 /** Triggers the click event, like [http://api.jquery.com/click/] */
110 click(Element element) { 111 click(Element element) {
111 // TODO(rnystrom): This should be on the DOM API somewhere. 112 // TODO(rnystrom): This should be on the DOM API somewhere.
112 MouseEvent event = new MouseEvent('click'); 113 MouseEvent event = new MouseEvent('click');
113 element.dispatchEvent(event); 114 element.dispatchEvent(event);
114 } 115 }
115 116
116
117 /** A proxy so we can intercept history calls */ 117 /** A proxy so we can intercept history calls */
118 class UIStateProxy extends SwarmState { 118 class UIStateProxy extends SwarmState {
119 List<Map<String, String>> history; 119 List<Map<String, String>> history;
120 120
121 UIStateProxy(Sections dataModel) : super(dataModel) { 121 UIStateProxy(Sections dataModel) : super(dataModel) {
122 clearHistory(); 122 clearHistory();
123 } 123 }
124 124
125 void pushToHistory() { 125 void pushToHistory() {
126 history.add(toHistory()); 126 history.add(toHistory());
(...skipping 19 matching lines...) Expand all
146 final length = closures.length; 146 final length = closures.length;
147 if (length > 0) { 147 if (length > 0) {
148 int i = 0; 148 int i = 0;
149 void invokeNext() { 149 void invokeNext() {
150 closures[i](); 150 closures[i]();
151 i++; 151 i++;
152 if (i < length) { 152 if (i < length) {
153 Timer.run(expectAsync(invokeNext)); 153 Timer.run(expectAsync(invokeNext));
154 } 154 }
155 } 155 }
156
156 Timer.run(expectAsync(invokeNext)); 157 Timer.run(expectAsync(invokeNext));
157 } 158 }
158 } 159 }
OLDNEW
« no previous file with comments | « samples-dev/swarm/swarm_ui_lib/view/view.dart ('k') | samples-dev/swarm/test/swarm_ui_lib/layout/css.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698