diff --git a/packages/mix/lib/src/properties/painting/decoration_mix.dart b/packages/mix/lib/src/properties/painting/decoration_mix.dart index 8313bb064..0c76efa7f 100644 --- a/packages/mix/lib/src/properties/painting/decoration_mix.dart +++ b/packages/mix/lib/src/properties/painting/decoration_mix.dart @@ -401,9 +401,8 @@ final class ShapeDecorationMix extends DecorationMix final shape = $shape; if (shape == null) return true; - // Check if it's a CircleBorderMix without eccentricity or RoundedRectangleBorderMix - // For now, we consider all CircleBorderMix as mergeable - // In the future, we might need to check eccentricity + // Only RoundedRectangleBorder shapes are mergeable right now. + // Other ShapeBorder types (e.g. CircleBorder) need dedicated merge handling. return shape is Prop; } diff --git a/packages/mix/lib/src/variants/variant_util.dart b/packages/mix/lib/src/variants/variant_util.dart index 49dfea0be..d1af15e09 100644 --- a/packages/mix/lib/src/variants/variant_util.dart +++ b/packages/mix/lib/src/variants/variant_util.dart @@ -266,22 +266,8 @@ class VariantAttributeBuilder> { return VariantStyle(variant, style); } - /// Creates a [VariantStyle] that applies the given styling elements - /// when this variant's condition is met. - /// - /// Supports both single and multiple style elements: - /// ```dart - /// // Single attribute - /// final hoverStyle = $on.hover($box.color.blue()); - /// - /// // Multiple attributes - /// final darkStyle = $on.dark( - /// $box.color.white(), - /// $text.style.color.black(), - /// ); - /// ``` - // This method has been removed as part of the MultiSpec/CompoundStyle cleanup. - // Variants should now be applied directly to specific spec types. + // Former attribute builder method removed as part of the + // MultiSpec/CompoundStyle cleanup. Apply variants directly to spec types. @override String toString() => 'VariantAttributeBuilder($variant)'; diff --git a/packages/mix/test/src/core/prop_token_ref_test.dart b/packages/mix/test/src/core/prop_token_ref_test.dart index bfdb439ff..d76b40d94 100644 --- a/packages/mix/test/src/core/prop_token_ref_test.dart +++ b/packages/mix/test/src/core/prop_token_ref_test.dart @@ -14,27 +14,27 @@ void main() { }); group('Current Behavior Tests', () { - test('ColorProp behavior - isAnyTokenRef detects it correctly', () { + test('ColorRef behavior - isAnyTokenRef detects it correctly', () { final colorToken = TestToken('test-color'); final colorRef = ColorRef(Prop.token(colorToken)); - // ColorProp should be detected as a token reference + // ColorRef should be detected as a token reference expect( isAnyTokenRef(colorRef), isTrue, - reason: 'Should detect ColorProp as token reference', + reason: 'Should detect ColorRef as token reference', ); - // ColorProp already has proper token behavior built-in + // ColorRef already has proper token behavior built-in expect( colorRef, PropMatcher.hasTokens, - reason: 'ColorProp should have token source', + reason: 'ColorRef should have token source', ); expect( colorRef, PropMatcher.isToken(colorToken), - reason: 'ColorProp should contain the original token', + reason: 'ColorRef should contain the original token', ); }); @@ -174,14 +174,14 @@ void main() { }); group('Verify detection functions work', () { - test('isAnyTokenRef detects ColorProp correctly', () { + test('isAnyTokenRef detects ColorRef correctly', () { final colorToken = TestToken('test-color'); final colorRef = ColorRef(Prop.token(colorToken)); expect( isAnyTokenRef(colorRef), isTrue, - reason: 'isAnyTokenRef should detect ColorProp', + reason: 'isAnyTokenRef should detect ColorRef', ); }); diff --git a/packages/mix/test/src/core/style_builder_test.dart b/packages/mix/test/src/core/style_builder_test.dart index 783acc520..d529626cb 100644 --- a/packages/mix/test/src/core/style_builder_test.dart +++ b/packages/mix/test/src/core/style_builder_test.dart @@ -76,7 +76,7 @@ void main() { }); testWidgets( - 'No animation driver when animation config is null', + 'Animation driver is still present when animation config is null', (tester) async { final boxAttribute = BoxStyler() .width(100) @@ -97,12 +97,9 @@ void main() { ), ); - // Verify that no animation wrapper is created - expect(find.byType(StyleAnimationBuilder), findsNothing); + // StyleSpecBuilder always wraps with StyleAnimationBuilder. + expect(find.byType(StyleAnimationBuilder), findsOneWidget); }, - skip: - // TODO: SHOULD REVIEW LATER: Skips because we are adding the animation driver everytime - true, ); testWidgets( diff --git a/packages/mix/test/src/specs/text/text_style_test.dart b/packages/mix/test/src/specs/text/text_style_test.dart index 32d5923b0..c86f6803a 100644 --- a/packages/mix/test/src/specs/text/text_style_test.dart +++ b/packages/mix/test/src/specs/text/text_style_test.dart @@ -381,10 +381,6 @@ void main() { expect(attribute.$softWrap, resolvesTo(true)); }); - test('maybeValue returns null for null spec', () { - expect(null, isNull); // TextStyling.maybeValue removed - }); - test('maybeValue returns attribute for non-null spec', () { const spec = TextSpec(overflow: TextOverflow.visible, maxLines: 1); final attribute = TextStyler( diff --git a/packages/mix/test/src/theme/material/material_tokens_test.dart b/packages/mix/test/src/theme/material/material_tokens_test.dart index 62a74ff65..0603aa770 100644 --- a/packages/mix/test/src/theme/material/material_tokens_test.dart +++ b/packages/mix/test/src/theme/material/material_tokens_test.dart @@ -63,12 +63,73 @@ void main() { ); }); - test( - 'Material 3 textStyles', - () { - // Skip: Token integration needs architectural review - tokens resolve to functions instead of TextStyle - }, - skip: 'Token integration needs architectural review', - ); + testWidgets('textStyles', (tester) async { + await tester.pumpWithMixScope(Container(), withMaterial: true); + final context = tester.element(find.byType(Container)); + final scope = MixScope.of(context); + final tokens = const MaterialTokens().textTheme; + final textTheme = Theme.of(context).textTheme; + + expect( + scope.getToken(tokens.displayLarge, context), + textTheme.displayLarge, + ); + expect( + scope.getToken(tokens.displayMedium, context), + textTheme.displayMedium, + ); + expect( + scope.getToken(tokens.displaySmall, context), + textTheme.displaySmall, + ); + expect( + scope.getToken(tokens.headlineLarge, context), + textTheme.headlineLarge, + ); + expect( + scope.getToken(tokens.headlineMedium, context), + textTheme.headlineMedium, + ); + expect( + scope.getToken(tokens.headlineSmall, context), + textTheme.headlineSmall, + ); + expect(scope.getToken(tokens.titleLarge, context), textTheme.titleLarge); + expect( + scope.getToken(tokens.titleMedium, context), + textTheme.titleMedium, + ); + expect(scope.getToken(tokens.titleSmall, context), textTheme.titleSmall); + expect(scope.getToken(tokens.bodyLarge, context), textTheme.bodyLarge); + expect(scope.getToken(tokens.bodyMedium, context), textTheme.bodyMedium); + expect(scope.getToken(tokens.bodySmall, context), textTheme.bodySmall); + expect(scope.getToken(tokens.labelLarge, context), textTheme.labelLarge); + expect(scope.getToken(tokens.labelMedium, context), textTheme.labelMedium); + expect(scope.getToken(tokens.labelSmall, context), textTheme.labelSmall); + + // Deprecated aliases + expect(scope.getToken(tokens.headline1, context), textTheme.displayLarge); + expect( + scope.getToken(tokens.headline2, context), + textTheme.displayMedium, + ); + expect(scope.getToken(tokens.headline3, context), textTheme.displaySmall); + expect( + scope.getToken(tokens.headline4, context), + textTheme.headlineMedium, + ); + expect( + scope.getToken(tokens.headline5, context), + textTheme.headlineSmall, + ); + expect(scope.getToken(tokens.headline6, context), textTheme.titleLarge); + expect(scope.getToken(tokens.subtitle1, context), textTheme.titleMedium); + expect(scope.getToken(tokens.subtitle2, context), textTheme.titleSmall); + expect(scope.getToken(tokens.bodyText1, context), textTheme.bodyLarge); + expect(scope.getToken(tokens.bodyText2, context), textTheme.bodyMedium); + expect(scope.getToken(tokens.caption, context), textTheme.bodySmall); + expect(scope.getToken(tokens.button, context), textTheme.labelLarge); + expect(scope.getToken(tokens.overline, context), textTheme.labelSmall); + }); }); }