Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/mix/lib/src/properties/painting/decoration_mix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,8 @@ final class ShapeDecorationMix extends DecorationMix<ShapeDecoration>
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<RoundedRectangleBorder>;
}
Expand Down
18 changes: 2 additions & 16 deletions packages/mix/lib/src/variants/variant_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,22 +266,8 @@ class VariantAttributeBuilder<T extends Spec<T>> {
return VariantStyle<T>(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)';
Expand Down
16 changes: 8 additions & 8 deletions packages/mix/test/src/core/prop_token_ref_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color>('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',
);
});

Expand Down Expand Up @@ -174,14 +174,14 @@ void main() {
});

group('Verify detection functions work', () {
test('isAnyTokenRef detects ColorProp correctly', () {
test('isAnyTokenRef detects ColorRef correctly', () {
final colorToken = TestToken<Color>('test-color');
final colorRef = ColorRef(Prop.token(colorToken));

expect(
isAnyTokenRef(colorRef),
isTrue,
reason: 'isAnyTokenRef should detect ColorProp',
reason: 'isAnyTokenRef should detect ColorRef',
);
});

Expand Down
9 changes: 3 additions & 6 deletions packages/mix/test/src/core/style_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -97,12 +97,9 @@ void main() {
),
);

// Verify that no animation wrapper is created
expect(find.byType(StyleAnimationBuilder<BoxSpec>), findsNothing);
// StyleSpecBuilder always wraps with StyleAnimationBuilder.
expect(find.byType(StyleAnimationBuilder<BoxSpec>), findsOneWidget);
},
skip:
// TODO: SHOULD REVIEW LATER: Skips because we are adding the animation driver everytime
true,
);

testWidgets(
Expand Down
4 changes: 0 additions & 4 deletions packages/mix/test/src/specs/text/text_style_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
75 changes: 68 additions & 7 deletions packages/mix/test/src/theme/material/material_tokens_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
Loading