| OLD | NEW |
| (Empty) | |
| 1 library ng_a_spec; |
| 2 |
| 3 import '../_specs.dart'; |
| 4 import 'dart:html' as dom; |
| 5 |
| 6 main() { |
| 7 describe('ADirective', () { |
| 8 TestBed _; |
| 9 |
| 10 beforeEach(inject((TestBed tb) => _ = tb)); |
| 11 |
| 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>'); |
| 14 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
| 15 expect(_.rootScope['abc']).toEqual(true); |
| 16 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true); |
| 17 })); |
| 18 |
| 19 it('should bind click listener when href empty', inject((Scope scope) { |
| 20 _.compile('<a href ng-click="abc = true; event = \$event"></a>'); |
| 21 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
| 22 expect(_.rootScope['abc']).toEqual(true); |
| 23 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true); |
| 24 })); |
| 25 |
| 26 it('should not bind click listener to non empty href', inject((Scope scope)
{ |
| 27 _.compile('<a href="#"></a>'); |
| 28 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
| 29 expect(window.location.href.endsWith("#")).toEqual(true); |
| 30 })); |
| 31 |
| 32 it('should not cancel click with non-empty interpolated href', inject((Scope
scope) { |
| 33 _.compile('<a href="{{url}}" ng-click="abc = true; event = \$event"></a>')
; |
| 34 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
| 35 expect(_.rootScope['abc']).toEqual(true); |
| 36 expect(_.rootScope['event'] is dom.UIEvent).toEqual(true); |
| 37 window.location.href = '#'; |
| 38 _.rootScope['url'] = '#url'; |
| 39 _.rootScope.$digest(); |
| 40 _.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
| 41 expect(window.location.href.endsWith("#url")).toEqual(true); |
| 42 })); |
| 43 }); |
| 44 } |
| OLD | NEW |