Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmolnar committed Jan 19, 2024
1 parent 44314c9 commit 91af11c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/spot/effective/effective_text.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import 'package:flutter/widgets.dart';
import 'package:spot/spot.dart';
import 'package:spot/src/checks/checks_nullability.dart';
import 'package:spot/src/spot/element_extensions.dart';
import 'package:spot/src/spot/selectors.dart';

/// Matchers for the [Text] widget to make assertions about:
/// - [Text.maxLines]
/// - [Text.textStyle]
extension EffectiveTextMatcher on WidgetMatcher<Text> {
/// Matches the [Text] widget when it has the given [maxLines].
///
Expand All @@ -20,6 +24,7 @@ extension EffectiveTextMatcher on WidgetMatcher<Text> {
);
}

/// Matches the [Text] widget for given maxLines.
WidgetMatcher<Text> hasEffectiveMaxLines(int? value) {
return hasEffectiveMaxLinesWhere((it) {
if (value == null) {
Expand All @@ -30,6 +35,7 @@ extension EffectiveTextMatcher on WidgetMatcher<Text> {
});
}

/// Matches the [Text] widget when it has the given [TextStyle].
WidgetMatcher<Text> hasEffectiveTextStyleWhere(MatchProp<TextStyle> match) {
return hasProp(
elementSelector: (subject) => subject.context.nest<TextStyle?>(
Expand Down Expand Up @@ -86,7 +92,7 @@ extension TextStyleSubject on Subject<TextStyle> {
/// - [Text.maxLines]
/// - [Text.textStyle]
extension EffectiveTextSelector on WidgetSelector<Text> {
/// Selects the [Text] widget where given maxLine properties match.
/// Selects the [Text] widget where given `maxLines` properties match.
WidgetSelector<Text> withEffectiveMaxLinesMatching(MatchProp<int?> match) {
return withProp(
elementSelector: (subject) => subject.context.nest<int?>(
Expand Down

0 comments on commit 91af11c

Please sign in to comment.