Skip to content

Commit

Permalink
add test for setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansen4857 committed Oct 14, 2023
1 parent 55fea4c commit d72b7d6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/widgets/editor/tree_widgets/editor_settings_tree_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void main() {
setUp(() async {
SharedPreferences.setMockInitialValues({
PrefsKeys.snapToGuidelines: false,
PrefsKeys.hidePathsOnHover: false,
});
prefs = await SharedPreferences.getInstance();
});
Expand Down Expand Up @@ -43,4 +44,33 @@ void main() {

expect(prefs.getBool(PrefsKeys.snapToGuidelines), false);
});

testWidgets('hide paths check', (widgetTester) async {
await widgetTester.pumpWidget(const MaterialApp(
home: Scaffold(
body: EditorSettingsTree(
initiallyExpanded: true,
),
),
));
await widgetTester.pump();

final row = find.widgetWithText(Row, 'Hide Other Paths on Hover');

expect(row, findsOneWidget);

final check = find.descendant(of: row, matching: find.byType(Checkbox));

expect(check, findsOneWidget);

await widgetTester.tap(check);
await widgetTester.pumpAndSettle();

expect(prefs.getBool(PrefsKeys.hidePathsOnHover), true);

await widgetTester.tap(check);
await widgetTester.pumpAndSettle();

expect(prefs.getBool(PrefsKeys.hidePathsOnHover), false);
});
}

0 comments on commit d72b7d6

Please sign in to comment.