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

Side by Side Diff: third_party/pkg/angular/test/directive/ng_a_spec.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 ng_a_spec; 1 library ng_a_spec;
2 2
3 import '../_specs.dart'; 3 import '../_specs.dart';
4 import 'dart:html' as dom; 4 import 'dart:html' as dom;
5 5
6 main() { 6 main() {
7 describe('ADirective', () { 7 describe('ADirective', () {
8 TestBed _; 8 TestBed _;
9 9
10 beforeEach(inject((TestBed tb) => _ = tb)); 10 beforeEach(inject((TestBed tb) => _ = tb));
11 11
12 it('should bind click listener when href zero length string', inject((Scope scope) { 12 it('should bind click listener when href zero length string', inject((Scope scope) {
13 _.compile('<a href="" ng-click="abc = true; event = \$event"></a>'); 13 _.compile('<a href="" ng-click="abc = true; event = \$event"></a>');
14 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); 14 _.triggerEvent(_.rootElement, 'click', 'MouseEvent');
15 expect(_.rootScope.context['abc']).toEqual(true); 15 expect(_.rootScope['abc']).toEqual(true);
16 expect(_.rootScope.context['event'] is dom.UIEvent).toEqual(true); 16 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true);
17 })); 17 }));
18 18
19 it('should bind click listener when href empty', inject((Scope scope) { 19 it('should bind click listener when href empty', inject((Scope scope) {
20 _.compile('<a href ng-click="abc = true; event = \$event"></a>'); 20 _.compile('<a href ng-click="abc = true; event = \$event"></a>');
21 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); 21 _.triggerEvent(_.rootElement, 'click', 'MouseEvent');
22 expect(_.rootScope.context['abc']).toEqual(true); 22 expect(_.rootScope['abc']).toEqual(true);
23 expect(_.rootScope.context['event'] is dom.UIEvent).toEqual(true); 23 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true);
24 })); 24 }));
25 25
26 it('should not bind click listener to non empty href', inject((Scope scope) { 26 it('should not bind click listener to non empty href', inject((Scope scope) {
27 window.location.href = '#something';
28 _.compile('<a href="#"></a>'); 27 _.compile('<a href="#"></a>');
29 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); 28 _.triggerEvent(_.rootElement, 'click', 'MouseEvent');
30 expect(window.location.href.endsWith("#")).toEqual(true); 29 expect(window.location.href.endsWith("#")).toEqual(true);
31 })); 30 }));
32 31
33 it('should not cancel click with non-empty interpolated href', inject((Scope scope) { 32 it('should not cancel click with non-empty interpolated href', inject((Scope scope) {
34 _.compile('<a href="{{url}}" ng-click="abc = true; event = \$event"></a>') ; 33 _.compile('<a href="{{url}}" ng-click="abc = true; event = \$event"></a>') ;
35 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); 34 _.triggerEvent(_.rootElement, 'click', 'MouseEvent');
36 expect(_.rootScope.context['abc']).toEqual(true); 35 expect(_.rootScope['abc']).toEqual(true);
37 expect(_.rootScope.context['event'] is dom.UIEvent).toEqual(true); 36 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true);
38 window.location.href = '#'; 37 window.location.href = '#';
39 _.rootScope.context['url'] = '#url'; 38 _.rootScope['url'] = '#url';
40 _.rootScope.apply(); 39 _.rootScope.$digest();
41 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); 40 _.triggerEvent(_.rootElement, 'click', 'MouseEvent');
42 expect(window.location.href.endsWith("#url")).toEqual(true); 41 expect(window.location.href.endsWith("#url")).toEqual(true);
43 })); 42 }));
44 }); 43 });
45 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698