Skip to content

Commit

Permalink
chore: organise existing tests (#108)
Browse files Browse the repository at this point in the history
test: Organise tests folder, and increase code coverage and add goldens for existing tests
ci: add coverage to pr action
  • Loading branch information
thelukewalton authored Jun 24, 2024
1 parent 5c1ec1d commit 0e2d8be
Show file tree
Hide file tree
Showing 92 changed files with 1,880 additions and 902 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,26 @@ jobs:
# Saves output to either success or failure variables.
if [ "$failed" == "true" ]; then
echo "FAILURE=true" >> $GITHUB_OUTPUT
exit 1
fi
- name: Run tests
id: test
run: |
cd example
# Allows code to run after an error.
set -e
# Runs flutter test; saves output and if it fails.
out=$(flutter test) || failed='true'
out=$(flutter test --coverage) || failed='true'
echo "$out"
# Saves output to either success or failure variables.
if [ "$failed" == "true" ]; then
echo "FAILURE=true" >> $GITHUB_OUTPUT
exit 1
fi
- name: Check for modified files
id: git-check
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV
Expand All @@ -68,8 +69,8 @@ jobs:
git add -A
git commit -m '[automated commit] lint format and import sort'
git push
- name: Print outputs
if: always()
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand Down
22 changes: 18 additions & 4 deletions example/lib/pages/components/button_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _ButtonExampleState extends State<ButtonExample> {

void setFab(int index) => setState(() => fab = fabs[index]);

List<Widget> fabs = [];
List<ZetaFAB> fabs = [];
@override
Widget build(BuildContext context) {
if (fabs.isEmpty) {
Expand All @@ -38,12 +38,13 @@ class _ButtonExampleState extends State<ButtonExample> {
scrollController: _scrollController,
label: 'Small Circle Primary',
size: ZetaFabSize.small,
initiallyExpanded: false,
shape: ZetaWidgetBorder.full,
type: ZetaFabType.primary,
onPressed: () => setFab(0),
),
ZetaFAB(
scrollController: _scrollController,
initiallyExpanded: false,
label: 'Small Rounded Primary',
size: ZetaFabSize.small,
shape: ZetaWidgetBorder.rounded,
Expand All @@ -55,6 +56,7 @@ class _ButtonExampleState extends State<ButtonExample> {
label: 'Small Sharp Primary',
size: ZetaFabSize.small,
shape: ZetaWidgetBorder.sharp,
initiallyExpanded: false,
type: ZetaFabType.inverse,
onPressed: () => setFab(2),
),
Expand All @@ -64,13 +66,15 @@ class _ButtonExampleState extends State<ButtonExample> {
size: ZetaFabSize.large,
shape: ZetaWidgetBorder.full,
type: ZetaFabType.secondary,
initiallyExpanded: false,
onPressed: () => setFab(3),
),
ZetaFAB(
scrollController: _scrollController,
label: 'Large Rounded Secondary',
size: ZetaFabSize.large,
shape: ZetaWidgetBorder.rounded,
initiallyExpanded: false,
type: ZetaFabType.inverse,
onPressed: () => setFab(4),
),
Expand All @@ -80,14 +84,24 @@ class _ButtonExampleState extends State<ButtonExample> {
size: ZetaFabSize.large,
shape: ZetaWidgetBorder.sharp,
type: ZetaFabType.primary,
initiallyExpanded: false,
onPressed: () => setFab(5),
),
];
}

final ZetaFAB theFab = (fab as ZetaFAB?) ?? (fabs.first);
return ExampleScaffold(
name: 'Button',
floatingActionButton: fab ?? fabs.first,
floatingActionButton: ZetaFAB(
initiallyExpanded: true,
icon: theFab.icon,
label: theFab.label,
scrollController: _scrollController,
size: theFab.size,
type: theFab.type,
shape: theFab.shape,
onPressed: theFab.onPressed,
),
child: SingleChildScrollView(
controller: _scrollController,
child: Row(
Expand Down
24 changes: 0 additions & 24 deletions example/test/badge_test.dart

This file was deleted.

36 changes: 0 additions & 36 deletions example/test/button_test.dart

This file was deleted.

74 changes: 0 additions & 74 deletions example/test/checkbox_test.dart

This file was deleted.

61 changes: 0 additions & 61 deletions example/test/color_test.dart

This file was deleted.

Loading

0 comments on commit 0e2d8be

Please sign in to comment.