Index: third_party/pkg/angular/test/directive/ng_a_spec.dart |
diff --git a/third_party/pkg/angular/test/directive/ng_a_spec.dart b/third_party/pkg/angular/test/directive/ng_a_spec.dart |
index 0612495eca2f100d72fd7ee93354672a4529810c..7663f7592fe28f1c6efc16d3d836a27a588cbb71 100644 |
--- a/third_party/pkg/angular/test/directive/ng_a_spec.dart |
+++ b/third_party/pkg/angular/test/directive/ng_a_spec.dart |
@@ -4,33 +4,43 @@ import '../_specs.dart'; |
import 'dart:html' as dom; |
main() { |
+ isBrowser(String pattern) => window.navigator.userAgent.contains(pattern); |
+ |
describe('ADirective', () { |
TestBed _; |
- beforeEach(inject((TestBed tb) => _ = tb)); |
+ beforeEach((TestBed tb) => _ = tb); |
- it('should bind click listener when href zero length string', inject((Scope scope) { |
- _.compile('<a href="" ng-click="abc = true; event = \$event"></a>'); |
+ it('should bind click listener when href zero length string', (Scope scope) { |
+ _.compile('<a href="" ng-click="abc = 4; event = \$event"></a>'); |
_.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
- expect(_.rootScope.context['abc']).toEqual(true); |
+ expect(_.rootScope.context['abc']).toEqual(4); |
expect(_.rootScope.context['event'] is dom.UIEvent).toEqual(true); |
- })); |
+ }); |
- it('should bind click listener when href empty', inject((Scope scope) { |
- _.compile('<a href ng-click="abc = true; event = \$event"></a>'); |
+ it('should bind click listener when href empty', (Scope scope) { |
+ _.compile('<a href ng-click="abc = 5; event = \$event"></a>'); |
_.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
- expect(_.rootScope.context['abc']).toEqual(true); |
+ expect(_.rootScope.context['abc']).toEqual(5); |
expect(_.rootScope.context['event'] is dom.UIEvent).toEqual(true); |
- })); |
+ }); |
+ |
+ it('should not bind click listener to non empty href', (Scope scope) { |
+ // NOTE(deboer): In Firefox, after the dispatchEvent, the location.href |
+ // value does not update synchronously. I do not know how to test this. |
+ if (isBrowser('Firefox')) return; |
- it('should not bind click listener to non empty href', inject((Scope scope) { |
window.location.href = '#something'; |
_.compile('<a href="#"></a>'); |
_.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
expect(window.location.href.endsWith("#")).toEqual(true); |
- })); |
+ }); |
+ |
+ it('should not cancel click with non-empty interpolated href', (Scope scope) { |
+ // NOTE(deboer): In Firefox, after the dispatchEvent, the location.href |
+ // value does not update synchronously. I do not know how to test this. |
+ if (isBrowser('Firefox')) return; |
- it('should not cancel click with non-empty interpolated href', inject((Scope scope) { |
_.compile('<a href="{{url}}" ng-click="abc = true; event = \$event"></a>'); |
_.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
expect(_.rootScope.context['abc']).toEqual(true); |
@@ -40,6 +50,6 @@ main() { |
_.rootScope.apply(); |
_.triggerEvent(_.rootElement, 'click', 'MouseEvent'); |
expect(window.location.href.endsWith("#url")).toEqual(true); |
- })); |
+ }); |
}); |
} |