diff --git a/pkg/dev_compiler/test/browser/language_tests.js b/pkg/dev_compiler/test/browser/language_tests.js index 580c8096fe3..25ea068db3e 100644 --- a/pkg/dev_compiler/test/browser/language_tests.js +++ b/pkg/dev_compiler/test/browser/language_tests.js @@ -410,9 +410,6 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'require'], 'utf85_test': skip_timeout, }, - // TODO(jacobr): enable more of the html tests in unittest once they have - // more hope of passing. Triage tests that can never run in this test - // runner and track them separately. 'lib/html': { 'async_spawnuri_test': async_unittest, 'async_test': async_unittest, @@ -440,10 +437,7 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'require'], 'element_classes_test': 'fail', // sdk#27579. 'element_classes_svg_test': 'fail', // sdk#27579. - // This fails because we get 150 instead of 10 on line 45. - 'element_dimensions_test': 'fail', - - // Failure: 'Expected 364 to be in the inclusive range [111, 160].'. + // Failure: 'Expected 56 to be in the inclusive range [111, 160].'. 'element_offset_test': 'fail', 'element_test': async_unittest, 'element_types_test': 'fail', // sdk#27578. @@ -461,9 +455,6 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'require'], 'fontface_test': 'fail', 'form_data_test': async_unittest, 'history_test': async_unittest, - - // Failing because innerHtml should be 'Hello World' but was ''. - 'htmlelement_test': 'fail', 'indexeddb_1_test': async_unittest, 'indexeddb_2_test': async_unittest, 'indexeddb_3_test': async_unittest, @@ -482,92 +473,59 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'require'], // The "typed literal" test fails because the object does not have "_c". 'js_util_test': 'fail', - 'keyboard_event_test': ['unittest', 'skip', 'fail'], - 'localstorage_test': ['unittest', 'skip', 'fail'], - 'location_test': ['unittest', 'skip', 'fail'], - 'mediasource_test': ['unittest', 'skip', 'fail'], - 'media_stream_test': ['unittest', 'skip', 'fail'], - 'messageevent_test': ['unittest', 'skip', 'fail'], - 'mirrors_js_typed_interop_test': ['unittest', 'skip', 'fail'], - 'mouse_event_test': ['unittest', 'skip', 'fail'], - 'mutationobserver_test': ['unittest', 'skip', 'fail'], - 'native_gc_test': ['unittest', 'skip', 'fail'], - 'navigator_test': ['unittest', 'skip', 'fail'], - 'node_test': ['unittest', 'skip', 'fail'], - 'node_validator_important_if_you_suppress_make_the_bug_critical_test': ['unittest', 'skip', 'fail'], - 'non_instantiated_is_test': ['unittest', 'skip', 'fail'], - 'notification_test': ['unittest', 'skip', 'fail'], - 'performance_api_test': ['unittest', 'skip', 'fail'], - 'postmessage_structured_test': ['unittest', 'skip', 'fail'], - 'private_extension_member_test': ['unittest', 'skip', 'fail'], - 'queryall_test': ['unittest', 'skip', 'fail'], - 'query_test': ['unittest', 'skip', 'fail'], - 'range_test': ['unittest', 'skip', 'fail'], - 'request_animation_frame_test': ['unittest', 'skip', 'fail'], - 'resource_http_test': ['unittest', 'skip', 'fail'], - 'rtc_test': ['unittest', 'skip', 'fail'], - 'selectelement_test': ['unittest', 'skip', 'fail'], - 'serialized_script_value_test': ['unittest', 'skip', 'fail'], - 'shadow_dom_test': ['unittest', 'skip', 'fail'], - 'shadowroot_test': ['unittest', 'skip', 'fail'], - 'speechrecognition_test': ['unittest', 'skip', 'fail'], - 'storage_test': ['unittest', 'skip', 'fail'], - 'streams_test': ['unittest', 'skip', 'fail'], - 'svgelement_test': ['unittest', 'skip', 'fail'], - 'svg_test': ['unittest', 'skip', 'fail'], - 'table_test': ['unittest', 'skip', 'fail'], - 'touchevent_test': ['unittest', 'skip', 'fail'], - 'track_element_constructor_test': ['unittest', 'skip', 'fail'], - 'transferables_test': ['unittest', 'skip', 'fail'], - 'transition_event_test': ['unittest', 'skip', 'fail'], - 'trusted_html_tree_sanitizer_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_1_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_2_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_3_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_4_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_5_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_arraybuffer_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_dataview_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_range_checks_test': ['unittest', 'skip', 'fail'], - 'typed_arrays_simd_test': ['unittest', 'skip', 'fail'], - 'typing_test': ['unittest', 'skip', 'fail'], - 'unknownelement_test': ['unittest', 'skip', 'fail'], - 'uri_test': ['unittest', 'skip', 'fail'], - 'url_test': ['unittest', 'skip', 'fail'], - 'webgl_1_test': ['unittest', 'skip', 'fail'], - 'websocket_test': ['unittest', 'skip', 'fail'], - 'websql_test': ['unittest', 'skip', 'fail'], - 'wheelevent_test': ['unittest', 'skip', 'fail'], - 'window_eq_test': ['unittest', 'skip', 'fail'], - 'window_mangling_test': ['unittest', 'skip', 'fail'], - 'window_nosuchmethod_test': ['unittest', 'skip', 'fail'], - 'window_test': ['unittest', 'skip', 'fail'], - 'worker_api_test': ['unittest', 'skip', 'fail'], - 'worker_test': ['unittest', 'skip', 'fail'], - 'wrapping_collections_test': ['unittest', 'skip', 'fail'], - 'xhr_cross_origin_test': ['unittest', 'skip', 'fail'], - 'xhr_test': ['unittest', 'skip', 'fail'], - 'xsltprocessor_test': ['unittest', 'skip', 'fail'], + 'keyboard_event_test': async_unittest, - 'js_typed_interop_default_arg_test_none_multi': ['unittest', 'skip', 'fail'], - 'js_typed_interop_default_arg_test_explicit_argument_multi': ['unittest', 'skip', 'fail'], + 'mediasource_test': 'fail', // sdk#27578. + 'media_stream_test': 'fail', // sdk#27578. + 'messageevent_test': 'fail', // sdk#27578. + + // Should throw but does not. + 'mirrors_js_typed_interop_test': 'fail', + + 'mutationobserver_test': async_unittest, + 'native_gc_test': async_unittest, + 'node_validator_important_if_you_suppress_make_the_bug_critical_test': 'fail', // sdk#27578. + 'notification_test': 'fail', // sdk#27578. + 'performance_api_test': 'fail', // sdk#27578. + 'postmessage_structured_test': async_unittest, + 'range_test': 'fail', // sdk#27578. + 'request_animation_frame_test': async_unittest, + 'resource_http_test': async_unittest, + 'rtc_test': 'fail', // sdk#27578. + + // Expected 1, got null. + 'serialized_script_value_test': 'fail', + 'shadow_dom_test': 'fail', // sdk#27578. + 'shadowroot_test': 'fail', // sdk#27578. + 'speechrecognition_test': 'fail', // sdk#27578. + 'svgelement_test': 'fail', // sdk#27578. + 'touchevent_test': 'fail', // sdk#27578. + 'track_element_constructor_test': 'fail', // sdk#27578. + 'transferables_test': async_unittest, + 'transition_event_test': async_unittest, + 'url_test': async_unittest, + 'websocket_test': async_unittest, + 'websql_test': async_unittest, + 'wheelevent_test': async_unittest, + 'worker_api_test': async_unittest, + 'worker_test': async_unittest, + + 'xhr_cross_origin_test': async_unittest, + 'xhr_test': async_unittest, + 'xsltprocessor_test': 'fail', // sdk#27578. // Failing when it gets 3 instead of 42. 'js_typed_interop_default_arg_test_default_value_multi': 'fail', }, 'lib/html/custom': { - 'attribute_changed_callback_test': ['unittest', 'skip', 'fail'], - 'constructor_calls_created_synchronously_test': - ['unittest', 'skip', 'fail'], - 'created_callback_test': ['unittest', 'skip', 'fail'], - 'document_register_basic_test': ['unittest', 'skip', 'fail'], - 'document_register_type_extensions_test': ['unittest', 'skip', 'fail'], - 'element_upgrade_test': ['unittest', 'skip', 'fail'], - 'entered_left_view_test': ['unittest', 'skip', 'fail'], - 'js_custom_test': ['unittest', 'skip', 'fail'], - 'mirrors_test': ['unittest', 'skip', 'fail'], - 'regress_194523002_test': ['unittest', 'skip', 'fail'], + 'attribute_changed_callback_test': async_unittest, + 'constructor_calls_created_synchronously_test': async_unittest, + 'created_callback_test': async_unittest, + 'entered_left_view_test': async_unittest, + 'js_custom_test': async_unittest, + 'mirrors_test': async_unittest, + 'regress_194523002_test': async_unittest, }, 'lib/math': { @@ -820,6 +778,11 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'require'], } } + // If the test left any lingering detritus in the DOM, blow it away + // so it doesn't interfere with later tests. + document.body.innerHTML = ''; + console.log("cleared"); + if (!async_helper.asyncTestStarted) done(); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart b/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart index cf11b6373de..33f07bafb33 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart @@ -2,10 +2,10 @@ // 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. -library document_register_basic_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; + +import 'package:expect/minitest.dart'; + import '../utils.dart'; class Foo extends HtmlElement { @@ -45,8 +45,6 @@ class BadF implements HtmlElement { } main() { - useHtmlConfiguration(); - // Adapted from Blink's fast/dom/custom/document-register-basic test. setUp(() => customElementsReady); diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart b/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart index 67957b12323..682e821e8f7 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart @@ -2,10 +2,10 @@ // 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. -library document_register_type_extensions_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; + +import 'package:expect/minitest.dart'; + import '../utils.dart'; class Foo extends HtmlElement { diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart b/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart index c8e7376ea45..a1f071b5c54 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart @@ -2,13 +2,12 @@ // 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. -library register_element_proxy_test; - import 'dart:async'; import 'dart:html'; import 'dart:js' as js; -import 'package:unittest/html_config.dart'; -import 'package:unittest/unittest.dart'; + +import 'package:expect/minitest.dart'; + import '../utils.dart'; class FooElement extends HtmlElement { @@ -28,8 +27,6 @@ class FooElement extends HtmlElement { } main() { - useHtmlConfiguration(); - var registered = false; var upgrader; setUp(() => customElementsReady.then((_) { diff --git a/pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart b/pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart index 3e92b10dc7e..2ed126ec93e 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart @@ -2,49 +2,42 @@ // 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. -library LocalStorageTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; +import 'package:expect/minitest.dart'; + main() { - useHtmlConfiguration(); + setUp(() { + window.localStorage['key1'] = 'val1'; + window.localStorage['key2'] = 'val2'; + window.localStorage['key3'] = 'val3'; + }); - void testWithLocalStorage(String name, fn()) { - test(name, () { - window.localStorage['key1'] = 'val1'; - window.localStorage['key2'] = 'val2'; - window.localStorage['key3'] = 'val3'; + tearDown(() { + window.localStorage.clear(); + }); - try { - fn(); - } finally { - window.localStorage.clear(); - } - }); - } - - testWithLocalStorage('containsValue', () { + test('containsValue', () { expect(window.localStorage.containsValue('does not exist'), isFalse); expect(window.localStorage.containsValue('key1'), isFalse); expect(window.localStorage.containsValue('val1'), isTrue); expect(window.localStorage.containsValue('val3'), isTrue); }); - testWithLocalStorage('containsKey', () { + test('containsKey', () { expect(window.localStorage.containsKey('does not exist'), isFalse); expect(window.localStorage.containsKey('val1'), isFalse); expect(window.localStorage.containsKey('key1'), isTrue); expect(window.localStorage.containsKey('key3'), isTrue); }); - testWithLocalStorage('[]', () { + test('[]', () { expect(window.localStorage['does not exist'], isNull); expect(window.localStorage['key1'], 'val1'); expect(window.localStorage['key3'], 'val3'); }); - testWithLocalStorage('[]=', () { + test('[]=', () { expect(window.localStorage['key4'], isNull); window.localStorage['key4'] = 'val4'; expect(window.localStorage['key4'], 'val4'); @@ -54,29 +47,32 @@ main() { expect(window.localStorage['key3'], 'val3-new'); }); - testWithLocalStorage('putIfAbsent', () { + test('putIfAbsent', () { expect(window.localStorage['key4'], isNull); expect(window.localStorage.putIfAbsent('key4', () => 'val4'), 'val4'); expect(window.localStorage['key4'], 'val4'); expect(window.localStorage['key3'], 'val3'); expect(window.localStorage.putIfAbsent('key3', - () => expect(false, isTrue, reason: 'should not be called')), 'val3'); + () { + fail('should not be called'); + return 'unused'; + }), 'val3'); expect(window.localStorage['key3'], 'val3'); }); - testWithLocalStorage('remove', () { + test('remove', () { expect(window.localStorage.remove('does not exist'), isNull); expect(window.localStorage.remove('key3'), 'val3'); expect(window.localStorage, equals({'key1': 'val1', 'key2': 'val2'})); }); - testWithLocalStorage('clear', () { + test('clear', () { window.localStorage.clear(); expect(window.localStorage, equals({})); }); - testWithLocalStorage('forEach', () { + test('forEach', () { Map results = {}; window.localStorage.forEach((k, v) { results[k] = v; @@ -84,23 +80,23 @@ main() { expect(results, equals({'key1': 'val1', 'key2': 'val2', 'key3': 'val3'})); }); - testWithLocalStorage('getKeys', () { + test('getKeys', () { expect(window.localStorage.keys.toList(), unorderedEquals(['key1', 'key2', 'key3'])); }); - testWithLocalStorage('getVals', () { + test('getVals', () { expect(window.localStorage.values.toList(), unorderedEquals(['val1', 'val2', 'val3'])); }); - testWithLocalStorage('length', () { + test('length', () { expect(window.localStorage.length, 3); window.localStorage.clear(); expect(window.localStorage.length, 0); }); - testWithLocalStorage('isEmpty', () { + test('isEmpty', () { expect(window.localStorage.isEmpty, isFalse); window.localStorage.clear(); expect(window.localStorage.isEmpty, isTrue); diff --git a/pkg/dev_compiler/test/codegen/lib/html/location_test.dart b/pkg/dev_compiler/test/codegen/lib/html/location_test.dart index e274a2a02f0..703456d43b0 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/location_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/location_test.dart @@ -1,11 +1,8 @@ -library LocationTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { var isLocation = predicate((x) => x is Location, 'is a Location'); test('location hash', () { diff --git a/pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart b/pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart index 602c1998ba2..7dc5bde56af 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart @@ -2,14 +2,11 @@ // 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. -library media_stream_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported_media', () { test('supported', () { expect(MediaStream.supported, true); diff --git a/pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart b/pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart index 7db8af87166..f24b72d5394 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart @@ -1,14 +1,9 @@ -library mediasource_test; - -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; import 'dart:typed_data'; -import 'dart:async'; + +import 'package:expect/minitest.dart'; main() { - useHtmlIndividualConfiguration(); - var isMediaSource = predicate((x) => x is MediaSource, 'is a MediaSource'); group('supported', () { diff --git a/pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart b/pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart index 86348fdd820..ae051f9d315 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart @@ -1,11 +1,8 @@ -library SerializedScriptValueTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('new MessageEvent', () { final event = new MessageEvent('type', cancelable: true, data: 'data', origin: 'origin', lastEventId: 'lastEventId'); diff --git a/pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart b/pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart index f4b30a67c1c..e87729580f6 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart @@ -9,8 +9,7 @@ import 'dart:mirrors'; import 'dart:html'; import 'package:js/js.dart'; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; +import 'package:expect/minitest.dart'; _injectJs() { document.body.append(new ScriptElement() @@ -37,8 +36,6 @@ class Foo { main() { _injectJs(); - useHtmlConfiguration(); - test('dynamic dispatch', () { var f = foo; expect(f.x, 3); diff --git a/pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart b/pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart index 38792c27257..7d7b0d9c33b 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart @@ -2,14 +2,11 @@ // 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. -library mouse_event_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('relatedTarget', () { var event = new MouseEvent('mouseout'); expect(event.relatedTarget, isNull); diff --git a/pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart b/pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart index 2bc5cc89127..c0f2627668c 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart @@ -1,12 +1,7 @@ -library NavigatorTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/expect.dart'; - test('language never returns null', () { - expect(window.navigator.language, isNotNull); - }); +main() { + Expect.isNotNull(window.navigator.language); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/node_test.dart b/pkg/dev_compiler/test/codegen/lib/html/node_test.dart index 18f7f36dfff..0e2b435cae3 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/node_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/node_test.dart @@ -2,14 +2,13 @@ // 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. -library NodeTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; import 'dart:svg' as svg; +import 'package:expect/minitest.dart'; + Node makeNode() => new Element.tag('div'); -Node makeNodeWithChildren() => +Element makeNodeWithChildren() => new Element.html("
Foo
"); void testUnsupported(String name, void f()) { @@ -19,8 +18,6 @@ void testUnsupported(String name, void f()) { } main() { - useHtmlIndividualConfiguration(); - var isText = predicate((x) => x is Text, 'is a Text'); var isComment = predicate((x) => x is Comment, 'is a Comment'); var isBRElement = predicate((x) => x is BRElement, 'is a BRElement'); diff --git a/pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart b/pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart index 4d7d338393c..84821ffb9c2 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart @@ -10,8 +10,9 @@ library node_validator_test; import 'dart:html'; import 'dart:svg' as svg; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; + +import 'package:expect/minitest.dart'; + import 'utils.dart'; void validateHtml(String html, String reference, NodeValidator validator) { @@ -52,8 +53,6 @@ void testHtml(String name, NodeValidator validator, String html, } main() { - useHtmlIndividualConfiguration(); - group('DOM_sanitization', () { var validator = new NodeValidatorBuilder.common(); @@ -126,7 +125,7 @@ main() { ''; var fragment = document.body.createFragment(html, validator: validator); - var template = fragment.nodes.single; + var template = fragment.nodes.single as TemplateElement; var expectedContent = document.body.createFragment( '
' @@ -149,8 +148,9 @@ main() { var fragment = new DocumentFragment.html(html); fragment.appendHtml('
'); expect(fragment.childNodes.length, 1); - expect(fragment.childNodes[0].id, "bad"); - expect(fragment.childNodes[0].childNodes.length, 0); + var child = fragment.childNodes[0] as Element; + expect(child.id, "bad"); + expect(child.childNodes.length, 0); }); testHtml("sanitizes embed", @@ -500,7 +500,7 @@ main() { ''; var fragment = new DocumentFragment.svg(svgText); - var element = fragment.nodes.first; + var element = fragment.nodes.first as Element; expect(element is svg.SvgSvgElement, isTrue); expect(element.children[0] is svg.ImageElement, isTrue); }); @@ -542,7 +542,7 @@ main() { var fragment = document.body.createFragment( "
", validator: validator); - var form = fragment.lastChild; + var form = fragment.lastChild as FormElement; // If the tagName was clobbered, the sanitizer should have removed // the whole thing and form is null. // If the tagName was not clobbered, then there will be content, @@ -557,7 +557,7 @@ main() { var fragment = document.body.createFragment( "", validator: validator); - var form = fragment.lastChild; + var form = fragment.lastChild as FormElement; // If the tagName was clobbered, the sanitizer should have removed // the whole thing and form is null. // If the tagName was not clobbered, then there will be content, diff --git a/pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart b/pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart index b226ea7a40c..0865b073933 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart @@ -6,15 +6,11 @@ // checks of native classes that are not instantiated. import 'dart:html'; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; + +import 'package:expect/expect.dart'; var a = [new Object()]; main() { - useHtmlConfiguration(); - - test('is', () { - expect(a[0] is Node, isFalse); - }); + Expect.isFalse(a[0] is Node); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/notification_test.dart b/pkg/dev_compiler/test/codegen/lib/html/notification_test.dart index 077ea547d4c..283dc5bce27 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/notification_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/notification_test.dart @@ -2,15 +2,11 @@ // 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. -library notification_test; - -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported_notification', () { test('supported', () { expect(Notification.supported, true); diff --git a/pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart b/pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart index f4f1d287daa..b66feeb15c1 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart @@ -1,11 +1,8 @@ -library PerformanceApiTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported', () { test('supported', () { expect(Performance.supported, true); diff --git a/pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart b/pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart index 4512d9edf33..0425e95eb5e 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart @@ -13,6 +13,6 @@ main() { // // The createFragment() method sets `_innerHtml` on the element, so we use it // as a test case. - Expect.equals("[object DocumentFragment]", + Expect.equals("Instance of 'DocumentFragment'", new BRElement().createFragment("Hi").toString()); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/query_test.dart b/pkg/dev_compiler/test/codegen/lib/html/query_test.dart index bffe0d9ba77..f40aa260243 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/query_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/query_test.dart @@ -2,21 +2,18 @@ // 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. -library QueryTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { final div = new DivElement(); final canvas = new CanvasElement(width: 200, height: 200); canvas.id = 'testcanvas'; final element = new Element.html("

"); document.body.nodes.addAll([div, canvas, element]); - + var isCanvasElement = predicate((x) => x is CanvasElement, 'is a CanvasElement'); var isImageElement = @@ -47,7 +44,7 @@ main() { expect(l.length, 2); expect(l[0], isImageElement); expect(l[1], isImageElement); - expect(l[0], isNot(equals(l[1]))); + expect(l[0] == l[1], isFalse); }); test('queryAll (None)', () { diff --git a/pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart b/pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart index be4e67b5eae..c8c00f98022 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart @@ -2,14 +2,11 @@ // 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 -library NodeListTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { var isElement = predicate((x) => x is Element, 'is an Element'); var isCanvasElement = predicate((x) => x is CanvasElement, 'is a CanvasElement'); @@ -45,7 +42,7 @@ main() { }); test('queryAll-canvas', () { - List all = queryAll('canvas'); + var all = queryAll('canvas'); for (var e in all) { expect(e, isCanvasElement); } @@ -61,7 +58,7 @@ main() { test('queryAll-where', () { List all = queryAll('*'); - Iterable canvases = all.where((e) => e is CanvasElement); + var canvases = all.where((e) => e is CanvasElement); for (var e in canvases) { expect(e is CanvasElement, isTrue); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/range_test.dart b/pkg/dev_compiler/test/codegen/lib/html/range_test.dart index 5c2028d051f..01739fd1c5a 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/range_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/range_test.dart @@ -1,12 +1,8 @@ -library range_test; - import 'dart:html'; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; + +import 'package:expect/minitest.dart'; main() { - useHtmlIndividualConfiguration(); - group('supported', () { test('supports_createContextualFragment', () { expect(Range.supportsCreateContextualFragment, isTrue); diff --git a/pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart b/pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart index e55e79ff0f1..8582b3a4cea 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart @@ -2,17 +2,14 @@ // 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. -library RealTimeCommunicationTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported', () { test('supported', () { - expect(RtcPeerConnection.supported, true); + expect(RtcPeerConnection.supported, isTrue); }); }); diff --git a/pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart b/pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart index b56912c36de..94a9a29a669 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart @@ -2,14 +2,11 @@ // 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. -library selectelement_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('selectedOptions', () { var element = new SelectElement(); element.multiple = false; @@ -64,14 +61,14 @@ main() { '' '' '' - ''); + '') as SelectElement; expect(element.options.length, 2); element.selectedIndex = 1; var optGroup = element.children[1]; expect(optGroup is OptGroupElement, isTrue); - expect(optGroup.children.single.selected, isTrue); + expect((optGroup.children.single as OptionElement).selected, isTrue); expect(element.selectedOptions, optGroup.children); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart b/pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart index 16c8b438d8c..d4f5a9c1be8 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart @@ -1,21 +1,20 @@ -library SerializedScriptValueTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; + +import 'package:expect/minitest.dart'; + import 'utils.dart'; -serializationTest(name, value) => test(name, () { +serializationTest(name, value) { + test(name, () { // To check how value is serialized and deserialized, we create a // MessageEvent. final event = new MessageEvent('', data: value, origin: '', lastEventId: ''); verifyGraph(value, event.data); -}); - + }); +} main() { - useHtmlConfiguration(); - serializationTest('null', null); serializationTest('int', 1); serializationTest('double', 2.39); diff --git a/pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart b/pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart index 323d0e2ae1a..704e81abb62 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart @@ -2,14 +2,11 @@ // 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. -library ShadowDOMTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported', () { test('supported', () { expect(ShadowRoot.supported, true); @@ -17,7 +14,6 @@ main() { }); group('ShadowDOM_tests', () { - var div1, div2, shadowRoot, paragraph1, paragraph2; init() { diff --git a/pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart b/pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart index c3ac8d95090..4e9252de12c 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart @@ -2,14 +2,11 @@ // 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. -library ShadowRootTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { var isShadowRoot = predicate((x) => x is ShadowRoot, 'is a ShadowRoot'); diff --git a/pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart b/pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart index 16fd9dea129..e85531c18ed 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart @@ -2,14 +2,11 @@ // 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. -library speech_recognition_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported', () { test('supported', () { expect(SpeechRecognition.supported, true); diff --git a/pkg/dev_compiler/test/codegen/lib/html/storage_test.dart b/pkg/dev_compiler/test/codegen/lib/html/storage_test.dart index b68e9d499b8..c614ca97ccd 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/storage_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/storage_test.dart @@ -1,10 +1,8 @@ -library StorageTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; +import 'package:expect/minitest.dart'; + main() { - useHtmlConfiguration(); test('GetItem', () { final value = window.localStorage['does not exist']; expect(value, isNull); diff --git a/pkg/dev_compiler/test/codegen/lib/html/streams_test.dart b/pkg/dev_compiler/test/codegen/lib/html/streams_test.dart index edd77e75567..2a43f4ce3f6 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/streams_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/streams_test.dart @@ -1,9 +1,8 @@ -library streams_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:async'; import 'dart:html'; +import 'package:expect/minitest.dart'; + class StreamHelper { var _a; StreamHelper() { @@ -22,8 +21,6 @@ class StreamHelper { } main() { - useHtmlConfiguration(); - test('simple', () { var helper = new StreamHelper(); diff --git a/pkg/dev_compiler/test/codegen/lib/html/svg_test.dart b/pkg/dev_compiler/test/codegen/lib/html/svg_test.dart index b24084ac3f6..0477852ac32 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/svg_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/svg_test.dart @@ -2,15 +2,12 @@ // 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. -library SVGTest; import 'dart:html'; import 'dart:svg' as svg; -import 'package:unittest/html_individual_config.dart'; -import 'package:unittest/unittest.dart'; + +import 'package:expect/minitest.dart'; main() { - useHtmlIndividualConfiguration(); - group('svgPresence', () { var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); @@ -42,8 +39,7 @@ main() { """); - expect(logo, isSvgElement); - + expect(logo, isSvgElement); }); }); @@ -66,9 +62,13 @@ main() { var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement'); var isSvgSvgElement = predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); + var isNotSvgSvgElement = + predicate((x) => x is! svg.SvgSvgElement, 'is not a SvgSvgElement'); var isNode = predicate((x) => x is Node, 'is a Node'); var isSvgNumber = predicate((x) => x is svg.Number, 'is a svg.Number'); + var isNotSvgNumber = predicate((x) => x is! svg.Number, 'is not a svg.Number'); var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect'); + var isNotSvgRect = predicate((x) => x is! svg.Rect, 'is not a svg.Rect'); test('rect_isChecks', () { var div = insertTestDiv(); @@ -80,9 +80,9 @@ main() { expect(r, isNode); // Interfaces not implemented. - expect(r, isNot(isSvgNumber)); - expect(r, isNot(isSvgRect)); - expect(r, isNot(isSvgSvgElement)); + expect(r, isNotSvgNumber); + expect(r, isNotSvgRect); + expect(r, isNotSvgSvgElement); div.remove(); }); diff --git a/pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart b/pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart index 1fa725996ad..bd664207ca8 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart @@ -2,16 +2,12 @@ // 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. -library SvgElementTest; import 'dart:html'; import 'dart:svg' as svg; -import 'package:expect/expect.dart'; -import 'package:unittest/html_individual_config.dart'; -import 'package:unittest/unittest.dart'; + +import 'package:expect/minitest.dart'; main() { - useHtmlIndividualConfiguration(); - var isSvgSvgElement = predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement'); @@ -47,12 +43,12 @@ main() { ""; final el = new svg.SvgElement.svg(svgContent); expect(el, isSvgSvgElement); - expect(el.innerHtml, anyOf("", '", '')); - expect(el.outerHtml, anyOf(svgContent, + 'xmlns="http://www.w3.org/2000/svg" />'])); + expect(el.outerHtml, anyOf([svgContent, '\n ' - '\n \n')); + '\n \n'])); }); test('has no parent', () => diff --git a/pkg/dev_compiler/test/codegen/lib/html/table_test.dart b/pkg/dev_compiler/test/codegen/lib/html/table_test.dart index 7432e5d1bee..fca7e3ac3d9 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/table_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/table_test.dart @@ -2,14 +2,11 @@ // 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. -library TableTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('createTBody', () { var table = new TableElement(); var head = table.createTHead(); diff --git a/pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart b/pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart index fba6e6161d6..cd60245390a 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart @@ -2,14 +2,11 @@ // 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. -library touch_event_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; +main() { group('supported', () { test('supported', () { expect(TouchEvent.supported, true); diff --git a/pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart b/pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart index 883dabdbf86..b2077ee163d 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart @@ -11,19 +11,18 @@ import 'dart:html'; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; +import 'package:expect/minitest.dart'; void main() { - useHtmlConfiguration(); test('', () { if (!TrackElement.supported) return; document.body.append(new TrackElement()..defaultValue = true); - if (!document.query('track').defaultValue) { + var trackElement = document.query('track') as TrackElement; + if (!trackElement.defaultValue) { throw 'Expected default value to be true'; } - document.query('track').defaultValue = false; - if (document.query('track').defaultValue) { + trackElement.defaultValue = false; + if (trackElement.defaultValue) { throw 'Expected default value to be false'; } }); diff --git a/pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart b/pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart index c03e39d4074..3f9a534061e 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart @@ -6,14 +6,13 @@ /// for prevent XSS or other attacks. If you suppress this, or parts of it /// please make it a critical bug and bring it to the attention of the /// dart:html maintainers. -library trusted_html_tree_sanitizer_test; - +import 'dart:js' as js; import 'dart:html'; import 'dart:svg' as svg; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; + +import 'package:expect/minitest.dart'; + import 'utils.dart'; -import 'dart:js' as js; var oldAdoptNode; var jsDocument; @@ -33,8 +32,6 @@ restoreOldAdoptNode() { } main() { - useHtmlIndividualConfiguration(); - group('not_create_document_fragment', () { setUp(makeDocumentFragmentAdoptionThrow); tearDown(restoreOldAdoptNode); diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart index c3eb811a35c..3bbd336d20b 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart @@ -2,17 +2,16 @@ // 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. -library TypedArrays1Test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlIndividualConfiguration(); +import 'package:expect/minitest.dart'; - var isnumList = predicate((x) => x is List, 'is a List'); - var isStringList = predicate((x) => x is List, 'is a List'); +main() { + var isList = predicate((x) => x is List, 'is a List'); + var isNumList = predicate((x) => x is List, 'is a List'); + var isNotStringList = + predicate((x) => x is! List, 'is not a List'); var expectation = Platform.supportsTypedData ? returnsNormally : throws; group('supported', () { @@ -63,8 +62,8 @@ main() { expect(() { var a = new Float32List(10); expect(a, isList); - expect(a, isnumList); - expect(a, isNot(isStringList)); + expect(a, isNumList); + expect(a, isNotStringList); }, expectation); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart index 5a0d83a4db8..15a0bd6a595 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart @@ -2,15 +2,12 @@ // 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. -library TypedArrays2Test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart index efa4e17471d..b465a99baf2 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart @@ -2,15 +2,12 @@ // 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. -library TypedArrays3Test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart index 9f00357ec91..c75ade8080d 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart @@ -2,15 +2,12 @@ // 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. -library TypedArrays4Test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart index db149f68179..555a7c94174 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart @@ -2,15 +2,12 @@ // 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. -library typed_arrays_5_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart index 07541c8a47a..69c98bb8e0b 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart @@ -2,15 +2,12 @@ // 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. -library typed_arrays_arraybuffer_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart index a56aecd27ea..cd78a406415 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart @@ -2,15 +2,12 @@ // 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. -library typed_arrays_dataview_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart index 1eb2222cdae..4551f989109 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart @@ -2,12 +2,11 @@ // 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. -library TypedArraysRangeCheckTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; +import 'package:expect/minitest.dart'; + const N = 1024; class _TestList { @@ -28,14 +27,12 @@ _obfuscatedList() { } main() { - useHtmlConfiguration(); - // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; } - test('outOfRangeAccess_dynamic', () { + test('outOfRangeAccess', () { var a = _obfuscatedList(); expect(() => a[a.length], throws); @@ -54,24 +51,4 @@ main() { expect(() => a[1.5] = 0xdeadbeef, throws); expect(() => a['length'] = 1, throws); }); - - test('outOfRange_typed', () { - Uint8List a = new Uint8List(N); - - expect(() => a[a.length], throws); - expect(() => a[a.length + 1], throws); - expect(() => a[a.length + N], throws); - - expect(() => a[-1], throws); - expect(() => a[1.5], throws); - expect(() => a['length'], throws); - - expect(() => a[a.length] = 0xdeadbeef, throws); - expect(() => a[a.length + 1] = 0xdeadbeef, throws); - expect(() => a[a.length + N] = 0xdeadbeef, throws); - - expect(() => a[-1] = 0xdeadbeef, throws); - expect(() => a[1.5] = 0xdeadbeef, throws); - expect(() => a['length'] = 1, throws); - }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart index 0e3d780f3fb..5de04dd76e0 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart @@ -2,12 +2,11 @@ // 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. -library TypedArraysSimdTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:typed_data'; +import 'package:expect/minitest.dart'; + const _FLOATING_POINT_ERROR = 0.0000000001; floatEquals(value) => closeTo(value, _FLOATING_POINT_ERROR); @@ -19,8 +18,6 @@ class MyFloat32x4 { } main() { - useHtmlConfiguration(); - // Only perform tests if ArrayBuffer is supported. if (!Platform.supportsTypedData) { return; diff --git a/pkg/dev_compiler/test/codegen/lib/html/typing_test.dart b/pkg/dev_compiler/test/codegen/lib/html/typing_test.dart index 68ba294af47..e353bf5c413 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/typing_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/typing_test.dart @@ -1,11 +1,8 @@ -library TypingTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { var isStyleSheetList = predicate((x) => x is List, 'is a List'); @@ -23,15 +20,16 @@ main() { }); test('StyleSheetList', () { - List asList = window.document.styleSheets; + var document = window.document as HtmlDocument; + List asList = document.styleSheets; expect(asList, isStyleSheetList); // Check it's Iterable. int counter = 0; - for (StyleSheet styleSheet in window.document.styleSheets) { + for (StyleSheet styleSheet in document.styleSheets) { counter++; } - // There is one style sheet from the unittest framework. - expect(counter, 1); + // There are no style sheets. + expect(counter, 0); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart b/pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart index 21ba1ef1e19..43b30cf7ece 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart @@ -2,22 +2,19 @@ // 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 -library UnknownElementTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { var isUnknownElement = predicate((x) => x is UnknownElement, 'is an UnknownELement'); - var foo = new Element.tag('foo'); + dynamic foo = new Element.tag('foo'); foo.id = 'foo'; var bar = new Element.tag('bar'); bar.id = 'bar'; - document.body.nodes.addAll([foo, bar]); + document.body.nodes.addAll([foo, bar]); test('type-check', () { expect(foo, isUnknownElement); diff --git a/pkg/dev_compiler/test/codegen/lib/html/uri_test.dart b/pkg/dev_compiler/test/codegen/lib/html/uri_test.dart index 9079884934d..32ec8659f23 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/uri_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/uri_test.dart @@ -2,13 +2,11 @@ // 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 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('Uri.base', () { expect(Uri.base.scheme, "http"); expect(Uri.base.toString(), window.location.href); diff --git a/pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart b/pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart index d6e6f1f4cad..ce296ee82f2 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart @@ -2,19 +2,19 @@ // 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. -library web_gl_test; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; import 'dart:typed_data'; import 'dart:web_gl'; import 'dart:web_gl' as gl; +import 'package:expect/minitest.dart'; + // Test that WebGL is present in dart:web_gl API -main() { - useHtmlIndividualConfiguration(); +final isRenderingContext = predicate((x) => x is RenderingContext); +final isContextAttributes = predicate((x) => x is gl.ContextAttributes); +main() { group('supported', () { test('supported', () { expect(RenderingContext.supported, isTrue); @@ -27,7 +27,7 @@ main() { var context = canvas.getContext3d(); if (RenderingContext.supported) { expect(context, isNotNull); - expect(context, new isInstanceOf()); + expect(context, isRenderingContext); } else { expect(context, isNull); } @@ -36,7 +36,8 @@ main() { if (RenderingContext.supported) { test('simple', () { var canvas = new CanvasElement(); - var context = canvas.getContext('experimental-webgl'); + var context = + canvas.getContext('experimental-webgl') as gl.RenderingContext; var shader = context.createShader(gl.VERTEX_SHADER); context.shaderSource(shader, 'void main() { }'); context.compileShader(shader); @@ -48,11 +49,11 @@ main() { var canvas = new CanvasElement(); var context = canvas.getContext3d(); expect(context, isNotNull); - expect(context, new isInstanceOf()); + expect(context, isRenderingContext); context = canvas.getContext3d(depth: false); expect(context, isNotNull); - expect(context, new isInstanceOf()); + expect(context, isRenderingContext); }); test('texImage2D', () { @@ -95,7 +96,7 @@ main() { var attributes = context.getContextAttributes(); expect(attributes, isNotNull); - expect(attributes, new isInstanceOf()); + expect(attributes, isContextAttributes); expect(attributes.alpha, isBoolean); expect(attributes.antialias, isBoolean); diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart b/pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart index 6995a90833f..93313aba614 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart @@ -1,14 +1,12 @@ -library WindowEqualityTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; +import 'package:expect/minitest.dart'; + main() { - useHtmlConfiguration(); var obfuscated = null; test('notNull', () { expect(window, isNotNull); - expect(window, isNot(equals(obfuscated))); + expect(window != obfuscated, isTrue); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart b/pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart index f1a8b384da9..46f03c85c99 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart @@ -2,11 +2,10 @@ // 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. -library WindowManglingTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html' as dom; +import 'package:expect/minitest.dart'; + // Defined in dom.Window. get navigator => "Dummy"; @@ -14,13 +13,12 @@ $eq(x, y) => false; $eq$(x, y) => false; main() { - useHtmlConfiguration(); var win = dom.window; test('windowMethod', () { final message = navigator; final x = win.navigator; - expect(x, isNot(equals(message))); + expect(x, notEquals(message)); }); test('windowEquals', () { diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart b/pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart index 93cb592e074..4cc84b4f49f 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart @@ -2,12 +2,10 @@ // 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. -library WindowNSMETest; -import "package:expect/expect.dart"; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html' as dom; +import 'package:expect/minitest.dart'; + // Not defined in dom.Window. foo(x) => x; @@ -18,20 +16,12 @@ class Unused { int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); main() { - useHtmlConfiguration(); - var things = [new Unused(), dom.window]; + var things = [new Unused(), dom.window]; test('windowNonMethod', () { var win = things[inscrutable(1)]; final message = foo("Hello World"); - try { - String x = win.foo(message); - expect(false, isTrue, reason: 'Should not reach here: $x'); - } on NoSuchMethodError catch (e) { - // Expected exception. - } on Exception catch (e) { - expect(false, isTrue, reason: 'Wrong exception: $e'); - } + expect(() => win.foo(message), throwsNoSuchMethodError); }); test('foo', () { @@ -40,16 +30,10 @@ main() { expect(x, 'not bar'); }); - // Use dom.window direclty in case the compiler does type inference. + // Use dom.window directly in case the compiler does type inference. test('windowNonMethod2', () { final message = foo("Hello World"); - try { - String x = dom.window.foo(message); - expect(false, isTrue, reason: 'Should not reach here: $x'); - } on NoSuchMethodError catch (e) { - // Expected exception. - } on Exception catch (e) { - expect(false, isTrue, reason: 'Wrong exception: $e'); - } + expect(() => (dom.window as dynamic).foo(message), + throwsNoSuchMethodError); }); } diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_test.dart b/pkg/dev_compiler/test/codegen/lib/html/window_test.dart index 51ccdfd950a..ab79e666605 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/window_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/window_test.dart @@ -2,14 +2,11 @@ // 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. -library WindowTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; import 'dart:html'; -main() { - useHtmlConfiguration(); +import 'package:expect/minitest.dart'; +main() { test('scrollXY', () { expect(window.scrollX, 0); expect(window.scrollY, 0); diff --git a/pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart b/pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart index 218d255b46a..0d4fa1f5a72 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart @@ -1,10 +1,8 @@ -library wrapping_collection_test; - import 'dart:html'; import 'dart:html_common'; import 'dart:js' as js; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; + +import 'package:expect/minitest.dart'; /// Test that if we access objects through JS-interop we get the /// appropriate objects, even if dart:html maps them. diff --git a/pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart b/pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart index b645d816fed..3dd93a849a3 100644 --- a/pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart +++ b/pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart @@ -1,12 +1,8 @@ -library XSLTProcessorTest; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_individual_config.dart'; import 'dart:html'; +import 'package:expect/minitest.dart'; + main() { - - useHtmlIndividualConfiguration(); - group('supported', () { test('supported', () { expect(XsltProcessor.supported, true); diff --git a/pkg/dev_compiler/test/not_yet_strong_tests.dart b/pkg/dev_compiler/test/not_yet_strong_tests.dart index 7886944b18b..14df23156fe 100644 --- a/pkg/dev_compiler/test/not_yet_strong_tests.dart +++ b/pkg/dev_compiler/test/not_yet_strong_tests.dart @@ -2436,21 +2436,11 @@ final notYetStrongTests = new HashSet.from([ 'lib/html/js_typed_interop_side_cast_exp_test', 'lib/html/js_typed_interop_side_cast_test', 'lib/html/keyboard_event_test', - 'lib/html/localstorage_test', 'lib/html/mutationobserver_test', - 'lib/html/node_test', - 'lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test', 'lib/html/postmessage_structured_test', - 'lib/html/queryall_test', 'lib/html/resource_http_test', - 'lib/html/selectelement_test', - 'lib/html/track_element_constructor_test', 'lib/html/transferables_test', - 'lib/html/typed_arrays_range_checks_test', - 'lib/html/typing_test', - 'lib/html/unknownelement_test', 'lib/html/webgl_1_test', - 'lib/html/window_nosuchmethod_test', 'lib/html/wrapping_collections_test', // TODO(jmesserly): these are both under "dart:html" as well. 'js_test', diff --git a/pkg/expect/lib/minitest.dart b/pkg/expect/lib/minitest.dart index 980544c2839..d3057c2fa5b 100644 --- a/pkg/expect/lib/minitest.dart +++ b/pkg/expect/lib/minitest.dart @@ -161,6 +161,20 @@ Object same(Object value) => new _Expectation((actual) { Expect.identical(value, actual); }); +Object closeTo(num value, num tolerance) => new _Expectation((actual) { + Expect.approxEquals(value, actual, tolerance); + }); + +/// Succeeds if the actual value is any of the given strings. Unlike matcher's +/// [anyOf], this only works with strings and requires an explicit list. +Object anyOf(List expected) => new _Expectation((actual) { + for (var string in expected) { + if (actual == string) return; + } + + fail("Expected $actual to be one of $expected."); + }); + /// One level of group() nesting to track an optional [setUp()] and [tearDown()] /// function for the group. ///