mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:45:06 +00:00
e52de71408
It is unclear if this will help reduce flakiness and timeouts. Until now the test was setting the listener and making the transition on the same microtask. If the transition were to complete before the listener is fully set up, then that would explain the timeout: the transition event is never fired at that point. Honestly, I find this scenario hard to believe, but regardless it is worth a try. This small refactor changes the order to ensure the listener is set up upfront, and only later we initiate the transition. Change-Id: I3ae2bfae210ef307935c3d7f2aec9af82df1ddd9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332625 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com>
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file
|
|
|
|
library transition_event_test;
|
|
|
|
import 'dart:html';
|
|
import 'dart:async';
|
|
|
|
import 'package:async_helper/async_helper.dart';
|
|
import 'package:expect/minitest.dart';
|
|
|
|
Future testTransitionEnd() async {
|
|
var element = new DivElement();
|
|
document.body!.append(element);
|
|
|
|
element.style.opacity = '0';
|
|
element.style.width = '100px';
|
|
element.style.height = '100px';
|
|
element.style.background = 'red';
|
|
element.style.transition = 'opacity .1s';
|
|
final eventFuture = element.onTransitionEnd.first;
|
|
await Future.delayed(const Duration(milliseconds: 100));
|
|
element.style.opacity = '1';
|
|
final e = await eventFuture;
|
|
expect(e is TransitionEvent, isTrue);
|
|
expect(e.propertyName, 'opacity');
|
|
}
|
|
|
|
main() {
|
|
asyncTest(() async {
|
|
expect(CssStyleDeclaration.supportsTransitions, isTrue);
|
|
if (CssStyleDeclaration.supportsTransitions) {
|
|
await testTransitionEnd();
|
|
}
|
|
});
|
|
}
|