Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart

Issue 2413073002: Start cleaning up the HTML tests. (Closed)
Patch Set: Unfork expect.dart. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart b/pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart
index 9781c3c93c230c1e4a08c862656c492e072fea7c..b04f38925f89c29928945b3058c07f27f3f07e3e 100644
--- a/pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart
+++ b/pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart
@@ -1,8 +1,10 @@
-library ElementListTest;
-import 'package:unittest/unittest.dart';
-import 'package:unittest/html_config.dart';
import 'dart:html';
+import 'package:minitest/minitest.dart';
+
+bool isChecked(Element e) => (e as CheckboxInputElement).checked;
+bool isUnchecked(Element e) => !(e as CheckboxInputElement).checked;
+
// Test that List<Element> implements List<T>
main() {
Element insertTestDiv() {
@@ -32,15 +34,13 @@ main() {
return element;
}
- useHtmlConfiguration();
-
test('IsList', () {
Element root = insertTestDiv();
List<Element> eachChecked =
document.query('#allChecked').children;
- expect(eachChecked, isList);
+ expect(eachChecked is List, isTrue);
root.remove();
});
@@ -60,12 +60,12 @@ main() {
expect(someChecked.length, 4);
expect(noneChecked.length, 4);
- expect(eachChecked.every((x) => x.checked), isTrue);
- expect(eachChecked.every((x) => !x.checked), isFalse);
- expect(someChecked.every((x) => x.checked), isFalse);
- expect(someChecked.every((x) => !x.checked), isFalse);
- expect(noneChecked.every((x) => x.checked), isFalse);
- expect(noneChecked.every((x) => !x.checked), isTrue);
+ expect(eachChecked.every(isChecked), isTrue);
+ expect(eachChecked.every(isUnchecked), isFalse);
+ expect(someChecked.every(isChecked), isFalse);
+ expect(someChecked.every(isUnchecked), isFalse);
+ expect(noneChecked.every(isChecked), isFalse);
+ expect(noneChecked.every(isUnchecked), isTrue);
root.remove();
});
@@ -85,12 +85,12 @@ main() {
expect(someChecked.length, 4);
expect(noneChecked.length, 4);
- expect(eachChecked.any((x) => x.checked), isTrue);
- expect(eachChecked.any((x) => !x.checked), isFalse);
- expect(someChecked.any((x) => x.checked), isTrue);
- expect(someChecked.any((x) => !x.checked), isTrue);
- expect(noneChecked.any((x) => x.checked), isFalse);
- expect(noneChecked.any((x) => !x.checked), isTrue);
+ expect(eachChecked.any(isChecked), isTrue);
+ expect(eachChecked.any(isUnchecked), isFalse);
+ expect(someChecked.any(isChecked), isTrue);
+ expect(someChecked.any(isUnchecked), isTrue);
+ expect(noneChecked.any(isChecked), isFalse);
+ expect(noneChecked.any(isUnchecked), isTrue);
root.remove();
});
@@ -110,12 +110,12 @@ main() {
expect(someChecked.length, 4);
expect(noneChecked.length, 4);
- expect(eachChecked.where((x) => x.checked).length, 4);
- expect(eachChecked.where((x) => !x.checked).length, 0);
- expect(someChecked.where((x) => x.checked).length, 2);
- expect(someChecked.where((x) => !x.checked).length, 2);
- expect(noneChecked.where((x) => x.checked).length, 0);
- expect(noneChecked.where((x) => !x.checked).length, 4);
+ expect(eachChecked.where(isChecked).length, 4);
+ expect(eachChecked.where(isUnchecked).length, 0);
+ expect(someChecked.where(isChecked).length, 2);
+ expect(someChecked.where(isUnchecked).length, 2);
+ expect(noneChecked.where(isChecked).length, 0);
+ expect(noneChecked.where(isUnchecked).length, 4);
root.remove();
});
@@ -161,12 +161,12 @@ main() {
expect(someChecked.length, 4);
expect(noneChecked.length, 4);
- expect(countWithForEach(eachChecked, (x) => x.checked), 4);
- expect(countWithForEach(eachChecked, (x) => !x.checked), 0);
- expect(countWithForEach(someChecked, (x) => x.checked), 2);
- expect(countWithForEach(someChecked, (x) => !x.checked), 2);
- expect(countWithForEach(noneChecked, (x) => x.checked), 0);
- expect(countWithForEach(noneChecked, (x) => !x.checked), 4);
+ expect(countWithForEach(eachChecked, isChecked), 4);
+ expect(countWithForEach(eachChecked, isUnchecked), 0);
+ expect(countWithForEach(someChecked, isChecked), 2);
+ expect(countWithForEach(someChecked, isUnchecked), 2);
+ expect(countWithForEach(noneChecked, isChecked), 0);
+ expect(countWithForEach(noneChecked, isUnchecked), 4);
root.remove();
});
@@ -195,12 +195,12 @@ main() {
expect(someChecked.length, 4);
expect(noneChecked.length, 4);
- expect(countWithForLoop(eachChecked, (x) => x.checked), 4);
- expect(countWithForLoop(eachChecked, (x) => !x.checked), 0);
- expect(countWithForLoop(someChecked, (x) => x.checked), 2);
- expect(countWithForLoop(someChecked, (x) => !x.checked), 2);
- expect(countWithForLoop(noneChecked, (x) => x.checked), 0);
- expect(countWithForLoop(noneChecked, (x) => !x.checked), 4);
+ expect(countWithForLoop(eachChecked, isChecked), 4);
+ expect(countWithForLoop(eachChecked, isUnchecked), 0);
+ expect(countWithForLoop(someChecked, isChecked), 2);
+ expect(countWithForLoop(someChecked, isUnchecked), 2);
+ expect(countWithForLoop(noneChecked, isChecked), 0);
+ expect(countWithForLoop(noneChecked, isUnchecked), 4);
root.remove();
});

Powered by Google App Engine
This is Rietveld 408576698