fix: a new server could not be given its password
The form only rendered the password field when editing a saved server
(!_editNew). Adding a password-protected instance therefore failed with
"需要密码或已保存的凭据" and offered nowhere to type it. The field is now
always shown ("密码(如果需要)", empty for a passwordless server); a failed
connect that asks for a password focuses it, and a rejected password reads
as "密码错误,请重试".
Adds test/servers_form_test.dart. 0.3.18 (318).
This commit is contained in:
1 parent
e646130d1f
commit
d9d5424318
6 files changed
+70
-13
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:openchamber/screens/servers_screen.dart';
|
||||
import 'package:openchamber/state.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('a new server form offers the password field', (tester) async {
|
||||
final app = AppState();
|
||||
addTearDown(app.dispose);
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ServersScreen(app: app, startEditing: true),
|
||||
));
|
||||
|
||||
expect(find.text('添加服务器'), findsOneWidget);
|
||||
// New servers need it too: a password-protected instance rejects the
|
||||
// first attempt, and there must be somewhere to type the password.
|
||||
expect(find.text('密码(如果需要)'), findsOneWidget);
|
||||
expect(find.text('服务器密码;服务器未设置可留空'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user