OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 @license | 3 @license |
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
8 Code distributed by Google as part of the polymer project is also | 8 Code distributed by Google as part of the polymer project is also |
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
10 --> | 10 --> |
(...skipping 13 matching lines...) Expand all Loading... |
24 <test-control tabindex="-1"></test-control> | 24 <test-control tabindex="-1"></test-control> |
25 </template> | 25 </template> |
26 </test-fixture> | 26 </test-fixture> |
27 | 27 |
28 <test-fixture id="NestedFocusedState"> | 28 <test-fixture id="NestedFocusedState"> |
29 <template> | 29 <template> |
30 <nested-focusable></nested-focusable> | 30 <nested-focusable></nested-focusable> |
31 </template> | 31 </template> |
32 </test-fixture> | 32 </test-fixture> |
33 | 33 |
34 <test-fixture id="LightDOM"> | 34 <test-fixture id="LightDOM"> |
35 <template> | 35 <template> |
36 <test-light-dom> | 36 <test-light-dom> |
37 <input id="input"> | 37 <input id="input"> |
| 38 <nested-focusable></nested-focusable> |
38 </test-light-dom> | 39 </test-light-dom> |
39 </template> | 40 </template> |
40 </test-fixture> | 41 </test-fixture> |
41 | 42 |
42 <script> | 43 <script> |
43 suite('focused-state', function() { | 44 suite('focused-state', function() { |
44 var focusTarget; | 45 var focusTarget; |
45 | 46 |
46 setup(function() { | 47 setup(function() { |
47 focusTarget = fixture('TrivialFocusedState'); | 48 focusTarget = fixture('TrivialFocusedState'); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 MockInteractions.focus(focusable.$.input); | 113 MockInteractions.focus(focusable.$.input); |
113 | 114 |
114 expect(nBlurEvents).to.be.greaterThan(0); | 115 expect(nBlurEvents).to.be.greaterThan(0); |
115 expect(nFocusEvents).to.be.greaterThan(0); | 116 expect(nFocusEvents).to.be.greaterThan(0); |
116 }); | 117 }); |
117 | 118 |
118 }); | 119 }); |
119 | 120 |
120 | 121 |
121 suite('elements in the light dom', function() { | 122 suite('elements in the light dom', function() { |
122 var lightDOM, input; | 123 var lightDOM, input, lightDescendantShadowInput; |
123 | 124 |
124 setup(function() { | 125 setup(function() { |
125 lightDOM = fixture('LightDOM'); | 126 lightDOM = fixture('LightDOM'); |
126 input = document.querySelector('#input'); | 127 input = document.querySelector('#input'); |
| 128 lightDescendantShadowInput = Polymer.dom(lightDOM) |
| 129 .querySelector('nested-focusable').$.input; |
127 }); | 130 }); |
128 | 131 |
129 test('should not fire the focus event', function() { | 132 test('should not fire the focus event', function() { |
130 var nFocusEvents = 0; | 133 var nFocusEvents = 0; |
131 | 134 |
132 lightDOM.addEventListener('focus', function() { | 135 lightDOM.addEventListener('focus', function() { |
133 nFocusEvents += 1; | 136 nFocusEvents += 1; |
134 }); | 137 }); |
135 | 138 |
136 MockInteractions.focus(input); | 139 MockInteractions.focus(input); |
137 | 140 |
138 expect(nFocusEvents).to.be.equal(0); | 141 expect(nFocusEvents).to.be.equal(0); |
139 }); | 142 }); |
140 | 143 |
| 144 test('should not fire the focus event from shadow descendants', function()
{ |
| 145 var nFocusEvents = 0; |
| 146 |
| 147 lightDOM.addEventListener('focus', function() { |
| 148 nFocusEvents += 1; |
| 149 }); |
| 150 |
| 151 MockInteractions.focus(lightDescendantShadowInput); |
| 152 |
| 153 expect(nFocusEvents).to.be.equal(0); |
| 154 }); |
| 155 |
141 }); | 156 }); |
142 | 157 |
143 </script> | 158 </script> |
144 | 159 |
145 </body> | 160 </body> |
146 </html> | 161 </html> |
OLD | NEW |