From 53296536dec39cf41aeed9ab148402721253a5ec Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Tue, 14 Apr 2020 00:37:41 +0000 Subject: [PATCH] [dart:html] Add back lib/html/input_element_attributes_test Now that TextInputElement.value accepts a nullable value, this test can be added back to test null behavior. Change-Id: Ia17554314f25c5d09e113bb5c9c0a6b6f1cb1c03 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143190 Reviewed-by: Sigmund Cherem Commit-Queue: Srujan Gaddam --- .../html/input_element_attributes_test.dart | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/lib/html/input_element_attributes_test.dart diff --git a/tests/lib/html/input_element_attributes_test.dart b/tests/lib/html/input_element_attributes_test.dart new file mode 100644 index 00000000000..09730b934ff --- /dev/null +++ b/tests/lib/html/input_element_attributes_test.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:html'; + +import 'package:expect/minitest.dart'; + +@pragma('dart2js:noInline') +returnNothing() {} + +// Gets an undefined value from JS. +dynamic _undefined = returnNothing(); + +main() { + test('valueSetNull', () { + final e = new TextInputElement(); + e.value = null; + expect(e.value, ''); + }); + test('valueSetNullProxy', () { + final e = new TextInputElement(); + e.value = _undefined; + expect(e.value, 'undefined'); + }); +}