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

fix: Could not override GoldenTestTheme #127

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

Brainyoo
Copy link
Contributor

@Brainyoo Brainyoo commented Sep 17, 2024

Description

All our tests failed because the default GoldenTestTheme changed the background colour. The GoldenTestTheme cannot be overwritten as it is not exported via the barrel file.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@Brainyoo Brainyoo changed the title Could not override GoldenTestTheme fix: Could not override GoldenTestTheme Sep 17, 2024
@Brainyoo
Copy link
Contributor Author

We use AlchemistConfig.runWithConfig() for our tests. The background colour is applied with the changes. But at the time when the TableBorder is to be coloured, Zone.current[currentConfigKey] is suddenly null, which is why our colour is not applied.

@@ -30,6 +30,7 @@ abstract class GoldenTestRunner {
required Widget widget,
required ThemeData? globalConfigTheme,
required ThemeData? variantConfigTheme,
required GoldenTestTheme? goldenTestTheme,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that I didn't get a lint warning me that I had added a parameter to an overridden method that wasn't present in the paren't method 🤔

btrautmann
btrautmann previously approved these changes Sep 17, 2024
Copy link
Contributor

@btrautmann btrautmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the inconvenience, thanks for catching this.

domain lgtm
platform lgtm

@btrautmann
Copy link
Contributor

@Brainyoo it looks like there are a couple tests that need to be updated for these changes!

@btrautmann
Copy link
Contributor

We use AlchemistConfig.runWithConfig() for our tests. The background colour is applied with the changes. But at the time when the TableBorder is to be coloured, Zone.current[currentConfigKey] is suddenly null, which is why our colour is not applied.

@Brainyoo am I correct in saying that this would still exist after your PR lands, i.e this PR does not address this bug?

Copy link
Contributor

@btrautmann btrautmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering about the Theme Extension and whether we're expecting consumers to leverage that meaningfully or if we just want copyWith which we can hand roll as we have elsewhere. I don't see lerp being used meaningfully which made me wonder.

See next comment

lib/src/golden_test_theme.dart Show resolved Hide resolved
btrautmann
btrautmann previously approved these changes Sep 17, 2024
Copy link
Contributor

@btrautmann btrautmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, I got back on computer (was on mobile before) and now see how ThemeExtension is being used 👍

domain lgtm
platform lgtm

@btrautmann
Copy link
Contributor

@Brainyoo looks like just one failing test for borderColor

Copy link
Contributor

@btrautmann btrautmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain lgtm
platform lgtm

@btrautmann btrautmann merged commit 5d609ae into Betterment:main Sep 18, 2024
7 checks passed
@btrautmann
Copy link
Contributor

Thank you @Brainyoo!

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.

3 participants