diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart index 40775ea858d..c8e00136b93 100644 --- a/pkg/expect/lib/expect.dart +++ b/pkg/expect/lib/expect.dart @@ -484,6 +484,10 @@ class Expect { * the type of the exception you could write this: * * Expect.throws(myThrowingFunction, (e) => e is MyException); + * + * If `f` fails an expectation (i.e., throws an [ExpectException]), that + * exception is not caught by [Expect.throws]. The test is still considered + * failing. */ static void throws(void f(), [bool check(Object error), String reason]) { String msg = reason == null ? "" : "($reason)"; diff --git a/tests/lib_2/html/datalistelement_test.dart b/tests/lib_2/html/datalistelement_test.dart index 07a3835e953..df87da03f76 100644 --- a/tests/lib_2/html/datalistelement_test.dart +++ b/tests/lib_2/html/datalistelement_test.dart @@ -31,35 +31,40 @@ main() { document.body.nodes.removeLast(); }); - // Support is checked in element_types test. - var expectation = DataListElement.supported ? returnsNormally : throws; - test('is', () { - expect(() { + try { var list = document.query('#browsers'); expect(list, isDataListElement); - }, expectation); + } catch (e) { + expect(DataListElement.supported, false); + } }); test('list', () { - expect(() { + try { var list = document.query('#browsers') as DataListElement; var input = document.query('#input') as InputElement; expect(input.list, list); - }, expectation); + } catch (e) { + expect(DataListElement.supported, false); + } }); test('options', () { - expect(() { + try { var options = (document.query('#browsers') as DataListElement).options; expect(options.length, 5); - }, expectation); + } catch (e) { + expect(DataListElement.supported, false); + } }); test('create', () { - expect(() { + try { var list = new DataListElement(); expect(list, isDataListElement); - }, expectation); + } catch (e) { + expect(DataListElement.supported, false); + } }); } diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status index ae0a33675b0..6e09990ef5d 100644 --- a/tests/lib_2/lib_2_dart2js.status +++ b/tests/lib_2/lib_2_dart2js.status @@ -166,7 +166,6 @@ html/custom/document_register_basic_test: Skip # Times out, or unittest times ou html/dart_object_local_storage_test: Skip # sessionStorage NS_ERROR_DOM_NOT_SUPPORTED_ERR html/element_animate_test/timing_dict: RuntimeError # Issue 26730 html/element_classes_test: RuntimeError # Issue 27535 -html/element_types_constructors1_test: RuntimeError html/element_types_constructors4_test: RuntimeError html/element_types_content_test: Pass, RuntimeError # Issues 28983, 29922 html/element_types_keygen_test: RuntimeError # Issue 29922