-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixed the focus on the interactive window #9813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Pressing ctrl + 1/ctrl + 2 to focus on the interactive window will give focus to the input box. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import { defaultDataScienceSettings } from './helpers'; | |
import { addCode, getInteractiveCellResults, getOrCreateInteractiveWindow, runMountedTest } from './interactiveWindowTestHelpers'; | ||
import { MockDocumentManager } from './mockDocumentManager'; | ||
import { MockEditor } from './mockTextEditor'; | ||
import { waitForUpdate } from './reactHelpers'; | ||
import { createMessageEvent, waitForUpdate } from './reactHelpers'; | ||
import { | ||
addContinuousMockData, | ||
addInputMockData, | ||
|
@@ -36,9 +36,12 @@ import { | |
enterInput, | ||
escapePath, | ||
findButton, | ||
getInteractiveEditor, | ||
getLastOutputCell, | ||
srcDirectory, | ||
submitInput, | ||
toggleCellExpansion, | ||
typeCode, | ||
verifyHtmlOnCell, | ||
verifyLastCellInputState, | ||
waitForMessage, | ||
|
@@ -143,6 +146,47 @@ suite('DataScience Interactive Window output tests', () => { | |
} | ||
); | ||
|
||
runMountedTest( | ||
'Ctrl + 1/Ctrl + 2', | ||
async wrapper => { | ||
// Create an interactive window so that it listens to the results. | ||
const interactiveWindow = await getOrCreateInteractiveWindow(ioc); | ||
await interactiveWindow.show(); | ||
|
||
// Type in the input box | ||
const editor = getInteractiveEditor(wrapper); | ||
typeCode(editor, 'a=1\na'); | ||
|
||
// Give focus to a random div | ||
const reactDiv = wrapper | ||
.find('div') | ||
.first() | ||
.getDOMNode(); | ||
|
||
const domDiv = reactDiv.querySelector('div'); | ||
|
||
if (domDiv && ioc.postMessage) { | ||
domDiv.tabIndex = -1; | ||
domDiv.focus(); | ||
|
||
// send the ctrl + 1/2 message, this should put focus back on the input box | ||
const message = createMessageEvent({ type: InteractiveWindowMessages.Activate, payload: undefined }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any tests for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It mentions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, ignore that. |
||
ioc.postMessage(message); | ||
|
||
// Then enter press shift + enter on the active element | ||
const activeElement = document.activeElement; | ||
if (activeElement) { | ||
await submitInput(ioc, activeElement as HTMLTextAreaElement); | ||
} | ||
} | ||
|
||
verifyHtmlOnCell(wrapper, 'InteractiveCell', '<span>1</span>', CellPosition.Last); | ||
}, | ||
() => { | ||
return ioc; | ||
} | ||
); | ||
|
||
runMountedTest( | ||
'Collapse / expand cell', | ||
async wrapper => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.