mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:40:04 +00:00
[web] adjust transition test.
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>
This commit is contained in:
parent
4eede8584d
commit
e52de71408
|
@ -19,19 +19,12 @@ Future testTransitionEnd() async {
|
|||
element.style.height = '100px';
|
||||
element.style.background = 'red';
|
||||
element.style.transition = 'opacity .1s';
|
||||
|
||||
final done = new Completer();
|
||||
|
||||
new Timer(const Duration(milliseconds: 100), () {
|
||||
element.onTransitionEnd.first.then((e) {
|
||||
expect(e is TransitionEvent, isTrue);
|
||||
expect(e.propertyName, 'opacity');
|
||||
}).then(done.complete, onError: done.completeError);
|
||||
|
||||
element.style.opacity = '1';
|
||||
});
|
||||
|
||||
await done.future;
|
||||
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() {
|
||||
|
|
|
@ -21,19 +21,12 @@ Future testTransitionEnd() async {
|
|||
element.style.height = '100px';
|
||||
element.style.background = 'red';
|
||||
element.style.transition = 'opacity .1s';
|
||||
|
||||
final done = new Completer();
|
||||
|
||||
new Timer(const Duration(milliseconds: 100), () {
|
||||
element.onTransitionEnd.first.then((e) {
|
||||
expect(e is TransitionEvent, isTrue);
|
||||
expect(e.propertyName, 'opacity');
|
||||
}).then(done.complete, onError: done.completeError);
|
||||
|
||||
element.style.opacity = '1';
|
||||
});
|
||||
|
||||
await done.future;
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue