OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 if (itemView != null) { | 89 if (itemView != null) { |
90 click(itemView.node); | 90 click(itemView.node); |
91 state.expectHistory([getHistory(itemView.item)]); | 91 state.expectHistory([getHistory(itemView.item)]); |
92 } | 92 } |
93 }); | 93 }); |
94 | 94 |
95 test('SliderMenu', () { | 95 test('SliderMenu', () { |
96 Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); | 96 Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); |
97 | 97 |
98 // Find the first slider menu item, and click on the one next after it. | 98 // Find the first slider menu item, and click on the one next after it. |
99 click(document.queryAll('.${CSS.SM_ITEM}')[1]); | 99 click(document.querySelectorAll('.${CSS.SM_ITEM}')[1]); |
100 | 100 |
101 Expect.equals(getView(swarm.sections[1]), swarm.frontView.currentSection); | 101 Expect.equals(getView(swarm.sections[1]), swarm.frontView.currentSection); |
102 | 102 |
103 // Find the first menu item again and click on it. | 103 // Find the first menu item again and click on it. |
104 click(document.query('.${CSS.SM_ITEM}')); | 104 click(document.querySelector('.${CSS.SM_ITEM}')); |
105 | 105 |
106 Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); | 106 Expect.equals(getView(swarm.sections[0]), swarm.frontView.currentSection); |
107 }); | 107 }); |
108 } | 108 } |
109 | 109 |
110 /** Triggers the click event, like [http://api.jquery.com/click/] */ | 110 /** Triggers the click event, like [http://api.jquery.com/click/] */ |
111 click(Element element) { | 111 click(Element element) { |
112 // TODO(rnystrom): This should be on the DOM API somewhere. | 112 // TODO(rnystrom): This should be on the DOM API somewhere. |
113 MouseEvent event = new MouseEvent('click'); | 113 MouseEvent event = new MouseEvent('click'); |
114 element.dispatchEvent(event); | 114 element.dispatchEvent(event); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 void invokeNext() { | 150 void invokeNext() { |
151 closures[i](); | 151 closures[i](); |
152 i++; | 152 i++; |
153 if (i < length) { | 153 if (i < length) { |
154 Timer.run(expectAsync0(invokeNext)); | 154 Timer.run(expectAsync0(invokeNext)); |
155 } | 155 } |
156 } | 156 } |
157 Timer.run(expectAsync0(invokeNext)); | 157 Timer.run(expectAsync0(invokeNext)); |
158 } | 158 } |
159 } | 159 } |
OLD | NEW |