Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding tests to StickyHeader and StickyHeaderWidgetBuilder #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henriquezanfa
Copy link

@henriquezanfa henriquezanfa commented Dec 31, 2023

I want to make it safer to add new features/change the current code.
I started adding some tests so we can guarantee that the current state is not lost.

I had trouble validating the stuckAmount on StickyHeaderWidgetBuilder. If someone knows how to properly test it it would be great. What I tried was the following:

...
ListView.builder(
  itemCount: 100,
  itemBuilder: (context, index) {
    return StickyHeaderBuilder(
      builder: (context, stuckAmount) {
        capturedStuckAmount = stuckAmount;
        return SizedBox(
          height: 50.0,
          child: Text('Header #$index'),
        );
      },
      content: SizedBox(
        height: 200.0,
        child: Text('Content #$index'),
      ),
    );
  },
),
...
await tester.drag(find.byType(ListView), const Offset(0.0, -25.0));
await tester.pumpAndSettle();
expect(capturedStuckAmount, -0.5);

but the capturedStuckAmount was now what I expected, I don't know if it is something with tester.drag that I'm not aware of.

Anyway, the other tests are working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant