Migrate web_e2e_tests to null safety (#80628)

This commit is contained in:
Abhishek Ghaskata
2021-04-22 02:24:34 +05:30
committed by GitHub
parent fe57037ad7
commit 5d37df13f9
4 changed files with 12 additions and 14 deletions

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'dart:html';
import 'dart:js_util' as js_util;
@@ -39,7 +38,7 @@ void main() {
// Change the value of the TextFormField.
final TextFormField textFormField = tester.widget(finder);
textFormField.controller.text = 'New Value';
textFormField.controller?.text = 'New Value';
// DOM element's value also changes.
expect(input.value, 'New Value');
});
@@ -67,7 +66,7 @@ void main() {
// Change the value of the TextFormField.
final TextFormField textFormField = tester.widget(finder);
textFormField.controller.text = 'New Value';
textFormField.controller?.text = 'New Value';
// DOM element's value also changes.
expect(input.value, 'New Value');
});
@@ -225,8 +224,8 @@ void main() {
expect(input.hasAttribute('readonly'), isTrue);
// Make sure the entire text is selected.
TextRange range =
TextRange(start: input.selectionStart, end: input.selectionEnd);
TextRange? range =
TextRange(start: input.selectionStart!, end: input.selectionEnd!);
expect(range.textInside(text), text);
// Double tap to select the first word.
@@ -239,7 +238,7 @@ void main() {
await gesture.up();
await gesture.down(firstWordOffset);
await gesture.up();
range = TextRange(start: input.selectionStart, end: input.selectionEnd);
range = TextRange(start: input.selectionStart!, end: input.selectionEnd!);
expect(range.textInside(text), 'Lorem');
// Double tap to select the last word.
@@ -252,14 +251,14 @@ void main() {
await gesture.up();
await gesture.down(lastWordOffset);
await gesture.up();
range = TextRange(start: input.selectionStart, end: input.selectionEnd);
range = TextRange(start: input.selectionStart!, end: input.selectionEnd!);
expect(range.textInside(text), 'amet');
});
}
KeyboardEvent dispatchKeyboardEvent(
EventTarget target, String type, Map<String, dynamic> args) {
final dynamic jsKeyboardEvent = js_util.getProperty(window, 'KeyboardEvent');
final Object jsKeyboardEvent = js_util.getProperty(window, 'KeyboardEvent') as Object;
final List<dynamic> eventArgs = <dynamic>[
type,
args,

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'package:integration_test/integration_test_driver.dart' as test;
Future<void> main() async => test.integrationDriver();