Skip to content

Commit

Permalink
Add golden tests for small button widget
Browse files Browse the repository at this point in the history
  • Loading branch information
JvnSlv committed Jul 31, 2024
1 parent 5f79040 commit 3cb2b5e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/widget_toolkit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "0.1.1"
xml:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
import 'package:widget_toolkit/ui_components.dart';

Widget smallButtonFactory({
required ButtonStateModel state,
}) =>
SmallButton(onPressed: () {}, icon: Icons.add, state: state);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:widget_toolkit/ui_components.dart';

import '../../helpers/golden_helper.dart';
import '../../helpers/models/scenario.dart';
import 'factory/small_button_factory.dart';
// Import your SmallButton widget and other necessary files

void main() {
runGoldenTests([
generateDeviceBuilder(
widget: smallButtonFactory(state: ButtonStateModel.loading),
scenario: Scenario(name: 'small_button_loading')),
generateDeviceBuilder(
widget: smallButtonFactory(state: ButtonStateModel.enabled),
scenario: Scenario(name: 'small_button_enabled')),
generateDeviceBuilder(
widget: smallButtonFactory(state: ButtonStateModel.disabled),
scenario: Scenario(name: 'small_button_disabled')),
generateDeviceBuilder(
widget: smallButtonFactory(state: ButtonStateModel.pressed),
scenario: Scenario(name: 'small_button_pressed')),
]);
}

0 comments on commit 3cb2b5e

Please sign in to comment.