Skip to content

Commit 6e88be4

Browse files
committed
fix: e2e tests
1 parent 3aa618b commit 6e88be4

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

example/lib/src/screens/my_home_page.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ class _MyHomePageState extends State<MyHomePage> {
115115
}
116116

117117
void changePrimaryColor() {
118-
String text = 'FF' + primaryColorController.text.replaceAll('#', '');
119-
Color color = Color(int.parse(text, radix: 16));
120-
Instabug.setPrimaryColor(color);
118+
String text = primaryColorController.text.replaceAll('#', '');
119+
Instabug.setTheme(ThemeConfig(primaryColor: '#$text'));
121120
}
122121

123122
void setColorTheme(ColorTheme colorTheme) {

test/instabug_test.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,4 +433,24 @@ void main() {
433433
mHost.willRedirectToStore(),
434434
).called(1);
435435
});
436+
437+
test('[setTheme] should call host method with theme config', () async {
438+
const themeConfig = ThemeConfig(primaryColor: '#FF0000');
439+
440+
await Instabug.setTheme(themeConfig);
441+
442+
verify(
443+
mHost.setTheme(themeConfig.toMap()),
444+
).called(1);
445+
});
446+
447+
test('[setPrimaryColor] should call setTheme with primary color', () async {
448+
const color = Color(0xFFFF0000);
449+
450+
await Instabug.setPrimaryColor(color);
451+
452+
verify(
453+
mHost.setTheme(any),
454+
).called(1);
455+
});
436456
}

0 commit comments

Comments
 (0)