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

Side by Side Diff: third_party/pkg/angular/test/tools/selector_spec.dart

Issue 256553002: Revert "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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library angular.selector_spec; 1 library angular.selector_spec;
2 2
3 import 'package:angular/tools/selector.dart'; 3 import 'package:angular/tools/selector.dart';
4 import 'package:html5lib/dom.dart'; 4 import 'package:html5lib/dom.dart';
5 import 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
6 6
7 import '../jasmine_syntax.dart'; 7 import '../jasmine_syntax.dart';
8 8
9 void main() { 9 main() => describe('selector', () {
10 describe('selector', () {
11 10
12 it('should match directive on element', () { 11 it('should match directive on element', () {
13 var node = new Element.html('<b></b>'); 12 var node = new Element.html('<b></b>');
14 expect(matchesNode(node, 'b'), isTrue); 13 expect(matchesNode(node, 'b'), isTrue);
15 expect(matchesNode(node, 'em'), isFalse); 14 expect(matchesNode(node, 'em'), isFalse);
16 }); 15 });
17 16
18 it('should match directive on class', () { 17 it('should match directive on class', () {
19 var node = new Element.html('<div class="b"></div>'); 18 var node = new Element.html('<div class="b"></div>');
20 expect(matchesNode(node, '.b'), isTrue); 19 expect(matchesNode(node, '.b'), isTrue);
21 expect(matchesNode(node, '.c'), isFalse); 20 expect(matchesNode(node, '.c'), isFalse);
22 }); 21 });
23 22
24 23
25 it('should match directive on [attribute]', () { 24 it('should match directive on [attribute]', () {
26 var node = new Element.html('<div directive></div>'); 25 var node = new Element.html('<div directive></div>');
27 expect(matchesNode(node, '[directive]'), isTrue); 26 expect(matchesNode(node, '[directive]'), isTrue);
28 expect(matchesNode(node, '[directiff]'), isFalse); 27 expect(matchesNode(node, '[directiff]'), isFalse);
29 28
30 node = new Element.html('<div directive="abc"></div>'); 29 node = new Element.html('<div directive="abc"></div>');
31 expect(matchesNode(node, '[directive=abc]'), isTrue); 30 expect(matchesNode(node, '[directive=abc]'), isTrue);
32 expect(matchesNode(node, '[directive=bcd]'), isFalse); 31 expect(matchesNode(node, '[directive=bcd]'), isFalse);
33 }); 32 });
34 33
35 34
36 it('should match directive on element[attribute]', () { 35 it('should match directive on element[attribute]', () {
37 var node = new Element.html('<b directive=abc></b>'); 36 var node = new Element.html('<b directive=abc></b>');
38 expect(matchesNode(node, 'b[directive]'), isTrue); 37 expect(matchesNode(node, 'b[directive]'), isTrue);
39 expect(matchesNode(node, 'c[directive]'), isFalse); 38 expect(matchesNode(node, 'c[directive]'), isFalse);
40 }); 39 });
41 40
42 41
43 it('should match directive on [attribute=value]', () { 42 it('should match directive on [attribute=value]', () {
44 var node = new Element.html('<div directive=value></div>'); 43 var node = new Element.html('<div directive=value></div>');
45 expect(matchesNode(node, '[directive=value]'), isTrue); 44 expect(matchesNode(node, '[directive=value]'), isTrue);
46 }); 45 });
47 46
48 47
49 it('should match directive on element[attribute=value]', () { 48 it('should match directive on element[attribute=value]', () {
50 var node = new Element.html('<b directive=value></b>'); 49 var node = new Element.html('<b directive=value></b>');
51 expect(matchesNode(node, 'b[directive=value]'), isTrue); 50 expect(matchesNode(node, 'b[directive=value]'), isTrue);
52 expect(matchesNode(node, 'b[directive=wrongvalue]'), isFalse); 51 expect(matchesNode(node, 'b[directive=wrongvalue]'), isFalse);
53 }); 52 });
54 53
55 it('should match attributes', () { 54 it('should match attributes', () {
56 var node = new Element.html('<div attr="before-xyz-after"></div>'); 55 var node = new Element.html('<div attr="before-xyz-after"></div>');
57 expect(matchesNode(node, '[*=/xyz/]'), isTrue); 56 expect(matchesNode(node, '[*=/xyz/]'), isTrue);
58 expect(matchesNode(node, '[*=/xyzz/]'), isFalse); 57 expect(matchesNode(node, '[*=/xyzz/]'), isFalse);
59 }); 58 });
60 59
61 it('should match whildcard attributes', () { 60 it('should match whildcard attributes', () {
62 var node = new Element.html('<div attr-foo="blah"></div>'); 61 var node = new Element.html('<div attr-foo="blah"></div>');
63 expect(matchesNode(node, '[attr-*]'), isTrue); 62 expect(matchesNode(node, '[attr-*]'), isTrue);
64 expect(matchesNode(node, '[attr-*=blah]'), isTrue); 63 expect(matchesNode(node, '[attr-*=blah]'), isTrue);
65 expect(matchesNode(node, '[attr-*=halb]'), isFalse); 64 expect(matchesNode(node, '[attr-*=halb]'), isFalse);
66 expect(matchesNode(node, '[foo-*]'), isFalse); 65 expect(matchesNode(node, '[foo-*]'), isFalse);
67 expect(matchesNode(node, '[foo-*=blah]'), isFalse); 66 expect(matchesNode(node, '[foo-*=blah]'), isFalse);
68 expect(matchesNode(node, '[foo-*=halb]'), isFalse); 67 expect(matchesNode(node, '[foo-*=halb]'), isFalse);
69 }); 68 });
70 69
71 it('should match text', () { 70 it('should match text', () {
72 var node = new Text('before-abc-after'); 71 var node = new Text('before-abc-after');
73 expect(matchesNode(node, ':contains(/abc/)'), isTrue); 72 expect(matchesNode(node, ':contains(/abc/)'), isTrue);
74 expect(matchesNode(node, ':contains(/cde/)'), isFalse); 73 expect(matchesNode(node, ':contains(/cde/)'), isFalse);
75 }); 74 });
76 75
77 it('should match on multiple directives', () { 76 it('should match on multiple directives', () {
78 var node = new Element.html('<div directive="d" foo="f"></div>'); 77 var node = new Element.html('<div directive="d" foo="f"></div>');
79 expect(matchesNode(node, '[directive=d][foo=f]'), isTrue); 78 expect(matchesNode(node, '[directive=d][foo=f]'), isTrue);
80 expect(matchesNode(node, '[directive=d][bar=baz]'), isFalse); 79 expect(matchesNode(node, '[directive=d][bar=baz]'), isFalse);
81 }); 80 });
82 81
83 }); 82 });
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698