| OLD | NEW |
| 1 @TestOn('browser') | 1 @TestOn('browser') |
| 2 library polymer_elements.test.iron_behavior_active_state_test; | 2 library polymer_elements.test.iron_behavior_active_state_test; |
| 3 | 3 |
| 4 import 'dart:async'; | 4 import 'dart:async'; |
| 5 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 import 'dart:html'; | 6 import 'dart:html'; |
| 7 import 'dart:js'; | 7 import 'dart:js'; |
| 8 import 'package:polymer_interop/polymer_interop.dart'; | 8 import 'package:polymer_interop/polymer_interop.dart'; |
| 9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| 11 import 'package:web_components/web_components.dart'; | 11 import 'package:web_components/web_components.dart'; |
| 12 import 'fixtures/iron_behavior_elements.dart'; | 12 import 'fixtures/iron_behavior_elements.dart'; |
| 13 import 'common.dart'; | 13 import 'common.dart'; |
| 14 | 14 |
| 15 main() async { | 15 main() async { |
| 16 await initPolymer(); | 16 await initPolymer(); |
| 17 | 17 |
| 18 group('active-state', () { | 18 group('active-state', () { |
| 19 TestButton activeTarget; | 19 TestButton activeTarget; |
| 20 | 20 |
| 21 setUp(() { | 21 setUp(() { |
| 22 activeTarget = fixture('TrivialActiveState'); | 22 activeTarget = fixture('TrivialActiveState'); |
| 23 }); | 23 }); |
| 24 | 24 |
| 25 group('non-primary pointer input source', () { | |
| 26 test('does not cause state to change', () { | |
| 27 var rightClickMouseEvent = new CustomEvent('mousedown'); | |
| 28 new JsObject.fromBrowserObject(rightClickMouseEvent)['buttons'] = 2; | |
| 29 activeTarget.dispatchEvent(rightClickMouseEvent); | |
| 30 expect(activeTarget.pressed, false); | |
| 31 }); | |
| 32 }); | |
| 33 | |
| 34 group('active state with toggles attribute', () { | 25 group('active state with toggles attribute', () { |
| 35 setUp(() { | 26 setUp(() { |
| 36 activeTarget = fixture('ToggleActiveState'); | 27 activeTarget = fixture('ToggleActiveState'); |
| 37 }); | 28 }); |
| 29 |
| 30 group('when down', () { |
| 31 test('is pressed', () { |
| 32 down(activeTarget); |
| 33 expect(activeTarget.getAttribute('pressed'), isNotNull); |
| 34 }); |
| 35 }); |
| 38 | 36 |
| 39 group('when clicked', () { | 37 group('when clicked', () { |
| 40 test('is activated', () { | 38 test('is activated', () { |
| 41 var done = new Completer(); | 39 var done = new Completer(); |
| 42 downAndUp(activeTarget, () { | 40 downAndUp(activeTarget, () { |
| 43 try { | 41 try { |
| 44 expect(activeTarget.getAttribute('active'), isNotNull); | 42 expect(activeTarget.getAttribute('active'), isNotNull); |
| 45 expect(activeTarget.getAttribute('aria-pressed'), isNotNull); | 43 expect(activeTarget.getAttribute('aria-pressed'), isNotNull); |
| 46 expect(activeTarget.getAttribute('aria-pressed'), 'true'); | 44 expect(activeTarget.getAttribute('aria-pressed'), 'true'); |
| 47 done.complete(); | 45 done.complete(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 done.complete(e); | 184 done.complete(e); |
| 187 } | 185 } |
| 188 }); | 186 }); |
| 189 | 187 |
| 190 pressEnter(activeTarget); | 188 pressEnter(activeTarget); |
| 191 return done.future; | 189 return done.future; |
| 192 }); | 190 }); |
| 193 }); | 191 }); |
| 194 }); | 192 }); |
| 195 } | 193 } |
| OLD | NEW |