Skip to content

Commit f32fa86

Browse files
committed
emoji_reaction test: Check that RTL layout takes effect in test setup
We're about to refactor the way RTL gets applied. While we're at it, also check the width of the ReactionChipsList element.
1 parent be0f87d commit f32fa86

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/flutter_checks.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,13 @@ extension TypographyChecks on Subject<Typography> {
111111
extension InlineSpanChecks on Subject<InlineSpan> {
112112
Subject<TextStyle?> get style => has((x) => x.style, 'style');
113113
}
114+
115+
extension SizeChecks on Subject<Size> {
116+
Subject<double> get width => has((x) => x.width, 'width');
117+
Subject<double> get height => has((x) => x.height, 'height');
118+
}
119+
120+
extension ElementChecks on Subject<Element> {
121+
Subject<Size?> get size => has((t) => t.size, 'size');
122+
// TODO more
123+
}

test/widgets/emoji_reaction_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:io' as io;
22
import 'dart:io';
33

4+
import 'package:checks/checks.dart';
45
import 'package:flutter/foundation.dart';
56
import 'package:flutter/material.dart';
67
import 'package:flutter/services.dart';
@@ -13,6 +14,7 @@ import 'package:zulip/widgets/emoji_reaction.dart';
1314
import 'package:zulip/widgets/store.dart';
1415

1516
import '../example_data.dart' as eg;
17+
import '../flutter_checks.dart';
1618
import '../model/binding.dart';
1719
import '../model/test_store.dart';
1820
import '../test_images.dart';
@@ -63,6 +65,10 @@ void main() {
6365

6466
// global store, per-account store
6567
await tester.pumpAndSettle();
68+
69+
final reactionChipsList = tester.element(find.byType(ReactionChipsList));
70+
check(Directionality.of(reactionChipsList)).equals(textDirection);
71+
check(reactionChipsList).size.isNotNull().width.equals(width);
6672
}
6773

6874
// Smoke tests under various conditions.

0 commit comments

Comments
 (0)