| OLD | NEW |
| 1 library streams_test; | 1 library streams_test; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:async'; | 4 import 'dart:async'; |
| 5 import 'dart:html'; | 5 import 'dart:html'; |
| 6 | 6 |
| 7 class StreamHelper { | 7 class StreamHelper { |
| 8 var _a; | 8 var _a; |
| 9 StreamHelper() { | 9 StreamHelper() { |
| 10 _a = new TextInputElement(); | 10 _a = new TextInputElement(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 subscription.onData((_) { | 162 subscription.onData((_) { |
| 163 ++callCountOne; | 163 ++callCountOne; |
| 164 }); | 164 }); |
| 165 helper.pulse(); | 165 helper.pulse(); |
| 166 expect(callCountOne, 1); | 166 expect(callCountOne, 1); |
| 167 | 167 |
| 168 subscription.onData(null); | 168 subscription.onData(null); |
| 169 helper.pulse(); | 169 helper.pulse(); |
| 170 expect(callCountOne, 1); | 170 expect(callCountOne, 1); |
| 171 }); | 171 }); |
| 172 |
| 173 var stream = new StreamHelper().stream; |
| 174 // Streams have had some type-checking issues, these tests just validate that |
| 175 // those are OK. |
| 176 test('first', () { |
| 177 stream.first.then((_) {}); |
| 178 }); |
| 179 |
| 180 test('asBroadcastStream', () { |
| 181 stream.asBroadcastStream().listen((_) {}); |
| 182 }); |
| 183 |
| 184 test('where', () { |
| 185 stream.where((_) => true).listen((_) {}); |
| 186 }); |
| 187 |
| 188 test('mappedBy', () { |
| 189 stream.mappedBy((_) => null).listen((_) {}); |
| 190 }); |
| 191 |
| 192 test('reduce', () { |
| 193 stream.reduce(null, (_) => null).then((_) {}); |
| 194 }); |
| 195 |
| 196 test('contains', () { |
| 197 stream.contains((_) => true).then((_) {}); |
| 198 }); |
| 199 |
| 200 test('every', () { |
| 201 stream.every((_) => true).then((_) {}); |
| 202 }); |
| 203 |
| 204 test('any', () { |
| 205 stream.any((_) => true).then((_) {}); |
| 206 }); |
| 207 |
| 208 test('length', () { |
| 209 stream.length.then((_) {}); |
| 210 }); |
| 211 |
| 212 test('min', () { |
| 213 stream.min((a, b) => 0).then((_) {}); |
| 214 }); |
| 215 |
| 216 test('max', () { |
| 217 stream.max((a, b) => 0).then((_) {}); |
| 218 }); |
| 219 |
| 220 test('isEmpty', () { |
| 221 stream.isEmpty.then((_) {}); |
| 222 }); |
| 223 |
| 224 test('toList', () { |
| 225 stream.toList().then((_) {}); |
| 226 }); |
| 227 |
| 228 test('toSet', () { |
| 229 stream.toSet().then((_) {}); |
| 230 }); |
| 231 |
| 232 test('take', () { |
| 233 stream.take(1).listen((_) {}); |
| 234 }); |
| 235 |
| 236 test('takeWhile', () { |
| 237 stream.takeWhile((_) => false).listen((_) {}); |
| 238 }); |
| 239 |
| 240 test('skip', () { |
| 241 stream.skip(0).listen((_) {}); |
| 242 }); |
| 243 |
| 244 test('skipWhile', () { |
| 245 stream.skipWhile((_) => false).listen((_) {}); |
| 246 }); |
| 247 |
| 248 test('distinct', () { |
| 249 stream.distinct((a, b) => false).listen((_) {}); |
| 250 }); |
| 251 |
| 252 test('first', () { |
| 253 stream.first.then((_) {}); |
| 254 }); |
| 255 |
| 256 test('last', () { |
| 257 stream.last.then((_) {}); |
| 258 }); |
| 259 |
| 260 test('single', () { |
| 261 stream.single.then((_) {}); |
| 262 }); |
| 263 |
| 264 test('firstMatching', () { |
| 265 stream.firstMatching((_) => true).then((_) {}); |
| 266 }); |
| 267 |
| 268 test('lastMatching', () { |
| 269 stream.lastMatching((_) => true).then((_) {}); |
| 270 }); |
| 271 |
| 272 test('singleMatching', () { |
| 273 stream.singleMatching((_) => true).then((_) {}); |
| 274 }); |
| 275 |
| 276 test('elementAt', () { |
| 277 stream.elementAt(0).then((_) {}); |
| 278 }); |
| 172 } | 279 } |
| OLD | NEW |