|
@@ -1,11 +1,9 @@
|
|
import 'dart:collection';
|
|
import 'dart:collection';
|
|
|
|
|
|
import 'package:app_flowy/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart';
|
|
import 'package:app_flowy/plugins/grid/presentation/widgets/cell/select_option_cell/text_field.dart';
|
|
-import 'package:flowy_infra/theme.dart';
|
|
|
|
import 'package:flowy_sdk/protobuf/flowy-grid/protobuf.dart';
|
|
import 'package:flowy_sdk/protobuf/flowy-grid/protobuf.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
-import 'package:provider/provider.dart';
|
|
|
|
import 'package:textfield_tags/textfield_tags.dart';
|
|
import 'package:textfield_tags/textfield_tags.dart';
|
|
|
|
|
|
import '../bloc_test/grid_test/util.dart';
|
|
import '../bloc_test/grid_test/util.dart';
|
|
@@ -30,7 +28,7 @@ void main() {
|
|
remainder = remaining;
|
|
remainder = remaining;
|
|
select = options;
|
|
select = options;
|
|
},
|
|
},
|
|
- newText: (_) {},
|
|
|
|
|
|
+ newText: (text) => remainder = text,
|
|
textSeparators: const [','],
|
|
textSeparators: const [','],
|
|
textController: TextEditingController(),
|
|
textController: TextEditingController(),
|
|
);
|
|
);
|
|
@@ -40,10 +38,7 @@ void main() {
|
|
await tester.pumpWidget(
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
MaterialApp(
|
|
home: Material(
|
|
home: Material(
|
|
- child: Provider<AppTheme>.value(
|
|
|
|
- value: AppTheme.fromType(Brightness.light),
|
|
|
|
- child: textField,
|
|
|
|
- ),
|
|
|
|
|
|
+ child: textField,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
);
|
|
@@ -63,28 +58,15 @@ void main() {
|
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
expect(submit, 'an option');
|
|
expect(submit, 'an option');
|
|
|
|
|
|
- await tester.enterText(find.byType(TextField), ' another one ');
|
|
|
|
|
|
+ submit = '';
|
|
|
|
+ await tester.enterText(find.byType(TextField), ' ');
|
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
- expect(submit, 'another one');
|
|
|
|
|
|
+ expect(submit, '');
|
|
|
|
|
|
// test inputs containing commas
|
|
// test inputs containing commas
|
|
- await tester.enterText(find.byType(TextField), ' abcd,');
|
|
|
|
- expect(remainder, '');
|
|
|
|
- expect(select, ['abcd']);
|
|
|
|
-
|
|
|
|
- await tester.enterText(find.byType(TextField), ',acd, aaaa ');
|
|
|
|
- expect(remainder, 'aaaa ');
|
|
|
|
- expect(select, ['acd']);
|
|
|
|
-
|
|
|
|
- await tester.enterText(find.byType(TextField), 'a a, bbbb , ');
|
|
|
|
- expect(remainder, '');
|
|
|
|
|
|
+ await tester.enterText(find.byType(TextField), 'a a, bbbb , c');
|
|
|
|
+ expect(remainder, 'c');
|
|
expect(select, ['a a', 'bbbb']);
|
|
expect(select, ['a a', 'bbbb']);
|
|
-
|
|
|
|
- // test paste followed by submit
|
|
|
|
- await tester.enterText(find.byType(TextField), 'aaa, bbb, c');
|
|
|
|
- await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
|
|
- expect(select, ['aaa', 'bbb']);
|
|
|
|
- expect(submit, 'c');
|
|
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|