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

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

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
(Empty)
1 library ng_events_spec;
2
3 import '../_specs.dart';
4 import 'dart:html' as dom;
5
6 void addTest(String name, [String eventType='MouseEvent', String eventName]) {
7 if (eventName == null) {
8 eventName = name;
9 }
10
11 describe('ng-$name', () {
12 TestBed _;
13
14 beforeEach(inject((TestBed tb) => _ = tb));
15
16 it('should evaluate the expression on $name', inject(() {
17 _.compile('<button ng-$name="abc = true; event = \$event"></button>');
18 _.triggerEvent(_.rootElement, eventName, eventType);
19 expect(_.rootScope['abc']).toEqual(true);
20 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true);
21 }));
22 });
23 }
24
25 main() {
26 addTest('blur');
27 addTest('change');
28 addTest('click');
29 addTest('contextmenu');
30 // The event name differs from the ng- directive name.
31 addTest('doubleclick', 'MouseEvent', 'dblclick');
32 addTest('dragenter');
33 addTest('dragleave');
34 addTest('dragover');
35 addTest('dragstart');
36 addTest('drop');
37 addTest('focus');
38 addTest('keydown', 'KeyboardEvent');
39 addTest('keypress', 'KeyboardEvent');
40 addTest('keyup', 'KeyboardEvent');
41 addTest('mousedown');
42 addTest('mouseenter');
43 addTest('mouseleave');
44 addTest('mousemove');
45 addTest('mouseout');
46 addTest('mouseover');
47 addTest('mouseup');
48 addTest('mousewheel', 'MouseEvent', 'wheel');
49 addTest('scroll');
50 // These should be of type TouchEvent but that causes the tests to fail.
51 // They pass as a MouseEvent.
52 addTest('touchcancel'/*, 'TouchEvent'*/);
53 addTest('touchend'/*, 'TouchEvent'*/);
54 addTest('touchmove'/*, 'TouchEvent'*/);
55 addTest('touchstart'/*, 'TouchEvent'*/);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698