Events should bubble up the tree

Previously we reversed the event path by mistake before dispatching events.
This commit is contained in:
Adam Barth
2015-09-03 18:18:42 -07:00
parent bc169671c8
commit f5102d1137
5 changed files with 52 additions and 14 deletions

View File

@@ -0,0 +1,42 @@
import 'package:sky/widgets.dart';
import 'package:test/test.dart';
import 'widget_tester.dart';
void main() {
test('Events bubble up the tree', () {
WidgetTester tester = new WidgetTester();
List<String> log = new List<String>();
tester.pumpFrame(() {
return new Listener(
onPointerDown: (_) {
log.add('top');
},
child: new Listener(
onPointerDown: (_) {
log.add('middle');
},
child: new DecoratedBox(
decoration: const BoxDecoration(),
child: new Listener(
onPointerDown: (_) {
log.add('bottom');
},
child: new Text('X')
)
)
)
);
});
tester.tap(tester.findText('X'));
expect(log, equals([
'bottom',
'middle',
'top',
]));
});
}