Skip to content
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

Bump version check for notebook renderer ext and ignore stream mime types from a comm message #16408

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/kernels/execution/cellExecutionMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ export class CellExecutionMessageHandler implements IDisposable {
return;
}

if (msg.parent_header.msg_id === 'comm_msg' && msg.header.msg_type === 'stream') {
if (msg.parent_header.msg_type === 'comm_msg' && msg.header.msg_type === 'stream') {
// Fix for https://github.com/microsoft/vscode-jupyter/issues/15996
// We're not interested in stream messages that are part of comm messages.
return;
Expand Down Expand Up @@ -1237,5 +1237,5 @@ function doesNotebookRendererSupportRenderingNestedOutputsInWidgets() {
if (!version) {
return false;
}
return version.compare(new SemVer('1.0.23')) >= 0;
return version.compare(new SemVer('1.1.0')) >= 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
"import ipywidgets as widgets\n",
"from IPython.display import display\n",
"button = widgets.Button(description=\"Click Me!\")\n",
"out = widgets.Output()\n",
"\n",
"display(button)\n",
"\n",
"def on_button_clicked(b):\n",
" print(\"Button clicked.\")\n",
" with out:\n",
" print(\"Button clicked.\")\n",
"\n",
"button.on_click(on_button_clicked)"
]
Expand All @@ -24,7 +26,16 @@
"metadata": {},
"outputs": [],
"source": [
"display(button)"
"button"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"out"
]
}
],
Expand Down
28 changes: 0 additions & 28 deletions src/test/datascience/widgets/notebooks/interactive_button.ipynb

This file was deleted.

36 changes: 5 additions & 31 deletions src/test/datascience/widgets/standardWidgets.vscode.common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import {
runCell,
selectDefaultController,
waitForCellExecutionToComplete,
waitForExecutionCompletedSuccessfully,
waitForTextOutput
waitForExecutionCompletedSuccessfully
} from '../notebook/helper';
import { hideOutputPanel, initializeWidgetComms, Utils } from './commUtils';
import { WidgetRenderingTimeoutForTests } from './constants';
Expand Down Expand Up @@ -245,15 +244,17 @@ suite('Standard IPyWidget Tests @widgets', function () {
},
editor
);
const [cell0, cell1] = window.activeNotebookEditor!.notebook.getCells();
const [cell0, cell1, cell2] = window.activeNotebookEditor!.notebook.getCells();

await executeCellAndWaitForOutput(cell0, comms);
await executeCellAndWaitForOutput(cell1, comms);
await executeCellAndWaitForOutput(cell2, comms);
await assertOutputContainsHtml(cell0, comms, ['Click Me!', '<button']);
await assertOutputContainsHtml(cell1, comms, ['Click Me!', '<button']);

// Click the button and verify we have output in the same cell.
await clickWidget(comms, cell0, 'button');
await waitForTextOutput(cell0, 'Button clicked.', 1, false);
await assertOutputContainsHtml(cell2, comms, ['Button clicked.']);
});
test.skip('Widget renders after executing a notebook which was saved after previous execution', async () => {
// // https://github.com/microsoft/vscode-jupyter/issues/8748
Expand Down Expand Up @@ -483,33 +484,6 @@ suite('Standard IPyWidget Tests @widgets', function () {
() => `Output doesn't contain text 'Bar' or still contains 'Outside, Inside, Foo', html is ${html}`
);
});
test('Interactive Button', async () => {
await initializeNotebookForWidgetTest(
disposables,
{
templateFile: 'interactive_button.ipynb'
},
editor
);
const cell = window.activeNotebookEditor!.notebook.cellAt(0);

await executeCellAndWaitForOutput(cell, comms);
await assertOutputContainsHtml(cell, comms, ['Click Me!', '<button']);

// Click the button and verify we have output in other cells
await clickWidget(comms, cell, 'button');
await waitForCondition(
() => {
assert.strictEqual(getTextOutputValue(cell.outputs[1]).trim(), 'Button clicked');
return true;
},
5_000,
() =>
`Expected 'Button clicked' to exist in ${
cell.outputs.length > 1 ? getTextOutputValue(cell.outputs[1]) : '<Only one output>'
}`
);
});
test('Interactive Function', async () => {
await initializeNotebookForWidgetTest(
disposables,
Expand Down