parent
c0b2645b8a
commit
bc0134d3d6
@ -32,6 +32,7 @@ class _MainWidget extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const TextField(
|
const TextField(
|
||||||
key: Key('enabled text field'),
|
key: Key('enabled text field'),
|
||||||
|
maxLines: null,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Email',
|
labelText: 'Email',
|
||||||
suffixText: '@gmail.com',
|
suffixText: '@gmail.com',
|
||||||
@ -40,6 +41,7 @@ class _MainWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
key: const Key('disabled text field'),
|
key: const Key('disabled text field'),
|
||||||
|
maxLines: null,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Email',
|
labelText: 'Email',
|
||||||
suffixText: '@gmail.com',
|
suffixText: '@gmail.com',
|
||||||
|
@ -34,7 +34,6 @@ class _MainWidget extends StatelessWidget {
|
|||||||
key: Key('enabled password'),
|
key: Key('enabled password'),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
hintText: 'Enter your password',
|
|
||||||
),
|
),
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
),
|
),
|
||||||
@ -42,7 +41,6 @@ class _MainWidget extends StatelessWidget {
|
|||||||
key: Key('disabled password'),
|
key: Key('disabled password'),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
hintText: 'Enter your password',
|
|
||||||
),
|
),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
|
@ -30,4 +30,24 @@ void main() {
|
|||||||
expect(passwordField.enabled, isFalse);
|
expect(passwordField.enabled, isFalse);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('text field passwords do not have hint text', (WidgetTester tester) async {
|
||||||
|
await pumpsUseCase(tester, TextFieldPasswordUseCase());
|
||||||
|
expect(find.byType(TextField), findsExactly(2));
|
||||||
|
|
||||||
|
// Test the enabled password
|
||||||
|
{
|
||||||
|
final Finder finder = find.byKey(const Key('enabled password'));
|
||||||
|
final TextField textField = tester.widget<TextField>(finder);
|
||||||
|
expect(textField.decoration?.hintText, isNull);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test the disabled password
|
||||||
|
{
|
||||||
|
final Finder finder = find.byKey(const Key('disabled password'));
|
||||||
|
final TextField textField = tester.widget<TextField>(finder);
|
||||||
|
expect(textField.decoration?.hintText, isNull);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,28 @@ void main() {
|
|||||||
expect(textField.enabled, isFalse);
|
expect(textField.enabled, isFalse);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('font size increase does not ellipsize hint text', (WidgetTester tester) async {
|
||||||
|
await pumpsUseCase(tester, TextFieldUseCase());
|
||||||
|
await tester.pumpWidget(MaterialApp(
|
||||||
|
home: MediaQuery.withClampedTextScaling(
|
||||||
|
minScaleFactor: 3,
|
||||||
|
maxScaleFactor: 3,
|
||||||
|
child: Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return TextFieldUseCase().build(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
// Test the enabled text field
|
||||||
|
{
|
||||||
|
final Finder finder = find.byKey(const Key('enabled text field'));
|
||||||
|
await tester.tap(finder);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
final Size size = tester.getSize(finder);
|
||||||
|
// Should have a multi-line height.
|
||||||
|
expect(size.height, 280);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user