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

Unified Diff: third_party/pkg/angular/test/tools/selector_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: third_party/pkg/angular/test/tools/selector_spec.dart
diff --git a/third_party/pkg/angular/test/tools/selector_spec.dart b/third_party/pkg/angular/test/tools/selector_spec.dart
index 3c9a139386d2c6e42c78ac7ebbd87d8b14f044b9..38d69a0bbe31b17f79f52caa429cc2f083e89bc2 100644
--- a/third_party/pkg/angular/test/tools/selector_spec.dart
+++ b/third_party/pkg/angular/test/tools/selector_spec.dart
@@ -6,77 +6,79 @@ import 'package:unittest/unittest.dart';
import '../jasmine_syntax.dart';
-main() => describe('selector', () {
+void main() {
+ describe('selector', () {
+
+ it('should match directive on element', () {
+ var node = new Element.html('<b></b>');
+ expect(matchesNode(node, 'b'), isTrue);
+ expect(matchesNode(node, 'em'), isFalse);
+ });
+
+ it('should match directive on class', () {
+ var node = new Element.html('<div class="b"></div>');
+ expect(matchesNode(node, '.b'), isTrue);
+ expect(matchesNode(node, '.c'), isFalse);
+ });
+
+
+ it('should match directive on [attribute]', () {
+ var node = new Element.html('<div directive></div>');
+ expect(matchesNode(node, '[directive]'), isTrue);
+ expect(matchesNode(node, '[directiff]'), isFalse);
+
+ node = new Element.html('<div directive="abc"></div>');
+ expect(matchesNode(node, '[directive=abc]'), isTrue);
+ expect(matchesNode(node, '[directive=bcd]'), isFalse);
+ });
+
+
+ it('should match directive on element[attribute]', () {
+ var node = new Element.html('<b directive=abc></b>');
+ expect(matchesNode(node, 'b[directive]'), isTrue);
+ expect(matchesNode(node, 'c[directive]'), isFalse);
+ });
+
+
+ it('should match directive on [attribute=value]', () {
+ var node = new Element.html('<div directive=value></div>');
+ expect(matchesNode(node, '[directive=value]'), isTrue);
+ });
+
+
+ it('should match directive on element[attribute=value]', () {
+ var node = new Element.html('<b directive=value></b>');
+ expect(matchesNode(node, 'b[directive=value]'), isTrue);
+ expect(matchesNode(node, 'b[directive=wrongvalue]'), isFalse);
+ });
+
+ it('should match attributes', () {
+ var node = new Element.html('<div attr="before-xyz-after"></div>');
+ expect(matchesNode(node, '[*=/xyz/]'), isTrue);
+ expect(matchesNode(node, '[*=/xyzz/]'), isFalse);
+ });
+
+ it('should match whildcard attributes', () {
+ var node = new Element.html('<div attr-foo="blah"></div>');
+ expect(matchesNode(node, '[attr-*]'), isTrue);
+ expect(matchesNode(node, '[attr-*=blah]'), isTrue);
+ expect(matchesNode(node, '[attr-*=halb]'), isFalse);
+ expect(matchesNode(node, '[foo-*]'), isFalse);
+ expect(matchesNode(node, '[foo-*=blah]'), isFalse);
+ expect(matchesNode(node, '[foo-*=halb]'), isFalse);
+ });
+
+ it('should match text', () {
+ var node = new Text('before-abc-after');
+ expect(matchesNode(node, ':contains(/abc/)'), isTrue);
+ expect(matchesNode(node, ':contains(/cde/)'), isFalse);
+ });
+
+ it('should match on multiple directives', () {
+ var node = new Element.html('<div directive="d" foo="f"></div>');
+ expect(matchesNode(node, '[directive=d][foo=f]'), isTrue);
+ expect(matchesNode(node, '[directive=d][bar=baz]'), isFalse);
+ });
- it('should match directive on element', () {
- var node = new Element.html('<b></b>');
- expect(matchesNode(node, 'b'), isTrue);
- expect(matchesNode(node, 'em'), isFalse);
});
-
- it('should match directive on class', () {
- var node = new Element.html('<div class="b"></div>');
- expect(matchesNode(node, '.b'), isTrue);
- expect(matchesNode(node, '.c'), isFalse);
- });
-
-
- it('should match directive on [attribute]', () {
- var node = new Element.html('<div directive></div>');
- expect(matchesNode(node, '[directive]'), isTrue);
- expect(matchesNode(node, '[directiff]'), isFalse);
-
- node = new Element.html('<div directive="abc"></div>');
- expect(matchesNode(node, '[directive=abc]'), isTrue);
- expect(matchesNode(node, '[directive=bcd]'), isFalse);
- });
-
-
- it('should match directive on element[attribute]', () {
- var node = new Element.html('<b directive=abc></b>');
- expect(matchesNode(node, 'b[directive]'), isTrue);
- expect(matchesNode(node, 'c[directive]'), isFalse);
- });
-
-
- it('should match directive on [attribute=value]', () {
- var node = new Element.html('<div directive=value></div>');
- expect(matchesNode(node, '[directive=value]'), isTrue);
- });
-
-
- it('should match directive on element[attribute=value]', () {
- var node = new Element.html('<b directive=value></b>');
- expect(matchesNode(node, 'b[directive=value]'), isTrue);
- expect(matchesNode(node, 'b[directive=wrongvalue]'), isFalse);
- });
-
- it('should match attributes', () {
- var node = new Element.html('<div attr="before-xyz-after"></div>');
- expect(matchesNode(node, '[*=/xyz/]'), isTrue);
- expect(matchesNode(node, '[*=/xyzz/]'), isFalse);
- });
-
- it('should match whildcard attributes', () {
- var node = new Element.html('<div attr-foo="blah"></div>');
- expect(matchesNode(node, '[attr-*]'), isTrue);
- expect(matchesNode(node, '[attr-*=blah]'), isTrue);
- expect(matchesNode(node, '[attr-*=halb]'), isFalse);
- expect(matchesNode(node, '[foo-*]'), isFalse);
- expect(matchesNode(node, '[foo-*=blah]'), isFalse);
- expect(matchesNode(node, '[foo-*=halb]'), isFalse);
- });
-
- it('should match text', () {
- var node = new Text('before-abc-after');
- expect(matchesNode(node, ':contains(/abc/)'), isTrue);
- expect(matchesNode(node, ':contains(/cde/)'), isFalse);
- });
-
- it('should match on multiple directives', () {
- var node = new Element.html('<div directive="d" foo="f"></div>');
- expect(matchesNode(node, '[directive=d][foo=f]'), isTrue);
- expect(matchesNode(node, '[directive=d][bar=baz]'), isFalse);
- });
-
-});
+}

Powered by Google App Engine
This is Rietveld 408576698