Unverified Commit 82bf3189 authored by Tong Mu's avatar Tong Mu Committed by GitHub

Delete and Backspace shortcuts accept optional Shift modifier (#94966)

parent 8b198d60
...@@ -5037,6 +5037,50 @@ void main() { ...@@ -5037,6 +5037,50 @@ void main() {
reason: 'on $platform', reason: 'on $platform',
); );
expect(controller.text, isEmpty, reason: 'on $platform'); expect(controller.text, isEmpty, reason: 'on $platform');
controller.text = 'abc';
controller.selection = const TextSelection(baseOffset: 2, extentOffset: 2);
// Backspace
await sendKeys(
tester,
<LogicalKeyboardKey>[
LogicalKeyboardKey.backspace,
],
targetPlatform: defaultTargetPlatform,
);
expect(
selection,
equals(
const TextSelection(
baseOffset: 1,
extentOffset: 1,
),
),
reason: 'on $platform',
);
expect(controller.text, 'ac', reason: 'on $platform');
// Shift-backspace (same as backspace)
await sendKeys(
tester,
<LogicalKeyboardKey>[
LogicalKeyboardKey.backspace,
],
shift: true,
targetPlatform: defaultTargetPlatform,
);
expect(
selection,
equals(
const TextSelection(
baseOffset: 0,
extentOffset: 0,
),
),
reason: 'on $platform',
);
expect(controller.text, 'c', reason: 'on $platform');
} }
testWidgets('keyboard text selection works (RawKeyEvent)', (WidgetTester tester) async { testWidgets('keyboard text selection works (RawKeyEvent)', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment