@@ -202,67 +202,6 @@ describe('shared/shortcut', () => {
202202
203203 assert . called ( onPress ) ;
204204 } ) ;
205-
206- it ( 'fires shortcut when input selectionStart cannot be read' , ( ) => {
207- const onPress = sinon . stub ( ) ;
208- const removeShortcut = installShortcut ( 'a' , onPress , {
209- ignoreWhenEditable : true ,
210- } ) ;
211-
212- const input = document . createElement ( 'input' ) ;
213- Object . defineProperty ( input , 'selectionStart' , {
214- get ( ) {
215- throw new Error ( 'no selectionStart' ) ;
216- } ,
217- } ) ;
218- const event = new KeyboardEvent ( 'keydown' , { key : 'a' , bubbles : true } ) ;
219- Object . defineProperty ( event , 'target' , { value : input } ) ;
220-
221- document . documentElement . dispatchEvent ( event ) ;
222- removeShortcut ( ) ;
223-
224- assert . called ( onPress ) ;
225- } ) ;
226-
227- it ( 'does not trigger when target has role="textbox" if ignoreWhenEditable is set' , ( ) => {
228- const onPress = sinon . stub ( ) ;
229- const textbox = document . createElement ( 'div' ) ;
230- textbox . setAttribute ( 'role' , 'textbox' ) ;
231- document . body . appendChild ( textbox ) ;
232-
233- const removeShortcut = installShortcut ( 'a' , onPress , {
234- ignoreWhenEditable : true ,
235- } ) ;
236-
237- const event = new KeyboardEvent ( 'keydown' , { key : 'a' , bubbles : true } ) ;
238- Object . defineProperty ( event , 'target' , { value : textbox } ) ;
239- document . documentElement . dispatchEvent ( event ) ;
240-
241- removeShortcut ( ) ;
242- document . body . removeChild ( textbox ) ;
243-
244- assert . notCalled ( onPress ) ;
245- } ) ;
246-
247- it ( 'still triggers when target has a non-editable ARIA role if ignoreWhenEditable is set' , ( ) => {
248- const onPress = sinon . stub ( ) ;
249- const nonEditable = document . createElement ( 'div' ) ;
250- nonEditable . setAttribute ( 'role' , 'button' ) ;
251- document . body . appendChild ( nonEditable ) ;
252-
253- const removeShortcut = installShortcut ( 'a' , onPress , {
254- ignoreWhenEditable : true ,
255- } ) ;
256-
257- const event = new KeyboardEvent ( 'keydown' , { key : 'a' , bubbles : true } ) ;
258- Object . defineProperty ( event , 'target' , { value : nonEditable } ) ;
259- document . documentElement . dispatchEvent ( event ) ;
260-
261- removeShortcut ( ) ;
262- document . body . removeChild ( nonEditable ) ;
263-
264- assert . called ( onPress ) ;
265- } ) ;
266205 } ) ;
267206
268207 describe ( 'useShortcut' , ( ) => {
0 commit comments