@@ -36,7 +36,6 @@ const templateRootPath: Uri =
36
36
? urlPath . joinPath ( workspace . workspaceFolders [ 0 ] . uri , 'widgets' , 'notebooks' )
37
37
: Uri . file ( '' ) ;
38
38
export async function initializeNotebookForWidgetTest (
39
- api : IExtensionTestApi ,
40
39
disposables : IDisposable [ ] ,
41
40
options : { templateFile : string } | { notebookFile : Uri }
42
41
) {
@@ -55,7 +54,7 @@ export async function initializeNotebookForWidgetTest(
55
54
await commands . executeCommand ( 'workbench.action.closePanel' ) ;
56
55
await commands . executeCommand ( 'workbench.action.maximizeEditor' ) ;
57
56
await commands . executeCommand ( 'notebook.cell.collapseAllCellInputs' ) ;
58
- return initializeWidgetComms ( api . serviceContainer ) ;
57
+ return initializeWidgetComms ( disposables ) ;
59
58
}
60
59
export async function executeCellAndWaitForOutput ( cell : NotebookCell , comms : Utils ) {
61
60
await Promise . all ( [
@@ -136,21 +135,21 @@ suite('Standard IPyWidget Tests', function () {
136
135
} ) ;
137
136
suiteTeardown ( async ( ) => closeNotebooksAndCleanUpAfterTests ( disposables ) ) ;
138
137
test ( 'Slider Widget' , async function ( ) {
139
- const comms = await initializeNotebookForWidgetTest ( api , disposables , { templateFile : 'slider_widgets.ipynb' } ) ;
138
+ const comms = await initializeNotebookForWidgetTest ( disposables , { templateFile : 'slider_widgets.ipynb' } ) ;
140
139
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 0 ) ! ;
141
140
await executeCellAndWaitForOutput ( cell , comms ) ;
142
141
await assertOutputContainsHtml ( cell , comms , [ '6519' ] , '.widget-readout' ) ;
143
142
} ) ;
144
143
test ( 'Textbox Widget' , async ( ) => {
145
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
144
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
146
145
templateFile : 'standard_widgets.ipynb'
147
146
} ) ;
148
147
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 1 ) ! ;
149
148
await executeCellAndWaitForOutput ( cell , comms ) ;
150
149
await assertOutputContainsHtml ( cell , comms , [ '<input type="text' , 'Enter your name:' ] , '.widget-text' ) ;
151
150
} ) ;
152
151
test ( 'Linking Widgets slider to textbox widget' , async function ( ) {
153
- const comms = await initializeNotebookForWidgetTest ( api , disposables , { templateFile : 'slider_widgets.ipynb' } ) ;
152
+ const comms = await initializeNotebookForWidgetTest ( disposables , { templateFile : 'slider_widgets.ipynb' } ) ;
154
153
const [ , cell1 , cell2 , cell3 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ! ;
155
154
await executeCellAndDontWaitForOutput ( cell1 ) ;
156
155
await executeCellAndWaitForOutput ( cell2 , comms ) ;
@@ -165,15 +164,15 @@ suite('Standard IPyWidget Tests', function () {
165
164
await assertOutputContainsHtml ( cell2 , comms , [ '60' ] , '.widget-readout' ) ;
166
165
} ) ;
167
166
test ( 'Checkbox Widget' , async ( ) => {
168
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
167
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
169
168
templateFile : 'standard_widgets.ipynb'
170
169
} ) ;
171
170
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 2 ) ! ;
172
171
await executeCellAndWaitForOutput ( cell , comms ) ;
173
172
await assertOutputContainsHtml ( cell , comms , [ 'Check me' , '<input type="checkbox' ] , '.widget-checkbox' ) ;
174
173
} ) ;
175
174
test ( 'Button Widget (click button)' , async ( ) => {
176
- const comms = await initializeNotebookForWidgetTest ( api , disposables , { templateFile : 'button_widgets.ipynb' } ) ;
175
+ const comms = await initializeNotebookForWidgetTest ( disposables , { templateFile : 'button_widgets.ipynb' } ) ;
177
176
const [ cell0 , cell1 , cell2 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ;
178
177
179
178
await executeCellAndWaitForOutput ( cell0 , comms ) ;
@@ -189,7 +188,7 @@ suite('Standard IPyWidget Tests', function () {
189
188
await assertOutputContainsHtml ( cell2 , comms , [ 'Button clicked' ] ) ;
190
189
} ) ;
191
190
test ( 'Button Widget (click button in output of another cell)' , async ( ) => {
192
- const comms = await initializeNotebookForWidgetTest ( api , disposables , { templateFile : 'button_widgets.ipynb' } ) ;
191
+ const comms = await initializeNotebookForWidgetTest ( disposables , { templateFile : 'button_widgets.ipynb' } ) ;
193
192
const [ cell0 , cell1 , cell2 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ;
194
193
195
194
await executeCellAndWaitForOutput ( cell0 , comms ) ;
@@ -205,7 +204,7 @@ suite('Standard IPyWidget Tests', function () {
205
204
await assertOutputContainsHtml ( cell2 , comms , [ 'Button clicked' ] ) ;
206
205
} ) ;
207
206
test ( 'Button Widget with custom comm message' , async ( ) => {
208
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
207
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
209
208
templateFile : 'button_widget_comm_msg.ipynb'
210
209
} ) ;
211
210
const [ cell0 , cell1 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ;
@@ -220,7 +219,7 @@ suite('Standard IPyWidget Tests', function () {
220
219
} ) ;
221
220
test . skip ( 'Widget renders after executing a notebook which was saved after previous execution' , async ( ) => {
222
221
// https://github.com/microsoft/vscode-jupyter/issues/8748
223
- let comms = await initializeNotebookForWidgetTest ( api , disposables , { templateFile : 'standard_widgets.ipynb' } ) ;
222
+ let comms = await initializeNotebookForWidgetTest ( disposables , { templateFile : 'standard_widgets.ipynb' } ) ;
224
223
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 0 ) ! ;
225
224
await executeCellAndWaitForOutput ( cell , comms ) ;
226
225
await assertOutputContainsHtml ( cell , comms , [ '66' ] , '.widget-readout' ) ;
@@ -231,7 +230,7 @@ suite('Standard IPyWidget Tests', function () {
231
230
await closeActiveWindows ( ) ;
232
231
233
232
// Open this notebook again.
234
- comms = await initializeNotebookForWidgetTest ( api , disposables , { notebookFile : uri } ) ;
233
+ comms = await initializeNotebookForWidgetTest ( disposables , { notebookFile : uri } ) ;
235
234
236
235
// Verify we have output in the first cell.
237
236
assert . isOk ( cell . outputs . length , 'No outputs in the cell after saving nb' ) ;
@@ -240,7 +239,7 @@ suite('Standard IPyWidget Tests', function () {
240
239
await assertOutputContainsHtml ( cell , comms , [ '66' ] , '.widget-readout' ) ;
241
240
} ) ;
242
241
test . skip ( 'Widget renders after restarting kernel' , async ( ) => {
243
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
242
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
244
243
templateFile : 'standard_widgets.ipynb'
245
244
} ) ;
246
245
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 0 ) ! ;
@@ -263,7 +262,7 @@ suite('Standard IPyWidget Tests', function () {
263
262
} ) ;
264
263
test . skip ( 'Widget renders after interrupting kernel' , async ( ) => {
265
264
// https://github.com/microsoft/vscode-jupyter/issues/8749
266
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
265
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
267
266
templateFile : 'standard_widgets.ipynb'
268
267
} ) ;
269
268
const cell = vscodeNotebook . activeNotebookEditor ?. notebook . cellAt ( 0 ) ! ;
@@ -285,7 +284,7 @@ suite('Standard IPyWidget Tests', function () {
285
284
await assertOutputContainsHtml ( cell , comms , [ '66' ] , '.widget-readout' ) ;
286
285
} ) ;
287
286
test ( 'Nested Output Widgets' , async ( ) => {
288
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
287
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
289
288
templateFile : 'nested_output_widget.ipynb'
290
289
} ) ;
291
290
const [ cell1 , cell2 , cell3 , cell4 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ;
@@ -313,7 +312,7 @@ suite('Standard IPyWidget Tests', function () {
313
312
assert . strictEqual ( cell3 . outputs . length , 0 , 'Cell 3 should not have any output' ) ;
314
313
} ) ;
315
314
test ( 'More Nested Output Widgets' , async ( ) => {
316
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
315
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
317
316
templateFile : 'nested_output_widget2.ipynb'
318
317
} ) ;
319
318
const [ cell1 , cell2 , cell3 , cell4 , cell5 , cell6 ] = vscodeNotebook . activeNotebookEditor ! . notebook . getCells ( ) ;
@@ -443,7 +442,7 @@ suite('Standard IPyWidget Tests', function () {
443
442
) ;
444
443
} ) ;
445
444
test ( 'Interactive Button' , async ( ) => {
446
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
445
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
447
446
templateFile : 'interactive_button.ipynb'
448
447
} ) ;
449
448
const cell = vscodeNotebook . activeNotebookEditor ! . notebook . cellAt ( 0 ) ;
@@ -463,7 +462,7 @@ suite('Standard IPyWidget Tests', function () {
463
462
) ;
464
463
} ) ;
465
464
test ( 'Interactive Function' , async ( ) => {
466
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
465
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
467
466
templateFile : 'interactive_function.ipynb'
468
467
} ) ;
469
468
const cell = vscodeNotebook . activeNotebookEditor ! . notebook . cellAt ( 0 ) ;
@@ -489,7 +488,7 @@ suite('Standard IPyWidget Tests', function () {
489
488
assert . strictEqual ( getTextOutputValue ( cell . outputs [ 2 ] ) . trim ( ) , `'Hello World'` ) ;
490
489
} ) ;
491
490
test ( 'Interactive Plot' , async ( ) => {
492
- const comms = await initializeNotebookForWidgetTest ( api , disposables , {
491
+ const comms = await initializeNotebookForWidgetTest ( disposables , {
493
492
templateFile : 'interactive_plot.ipynb'
494
493
} ) ;
495
494
const cell = vscodeNotebook . activeNotebookEditor ! . notebook . cellAt ( 0 ) ;
0 commit comments