Skip to content

Commit

Permalink
Fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Jul 30, 2024
1 parent c6d0051 commit 45b4339
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/html-manager/src/htmlmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {

import { WidgetRenderer, WIDGET_MIMETYPE } from './output_renderers';
import { WidgetModel, WidgetView, DOMWidgetView } from '@jupyter-widgets/base';
import { requirePromise } from './utils';

export class HTMLManager extends ManagerBase {
constructor(options?: {
Expand Down Expand Up @@ -118,10 +117,10 @@ export class HTMLManager extends ManagerBase {

if (best === '1.2.0') {
// ipywidgets 7 model
requirePromise(['@jupyter-widgets/base7']).then(resolve);
resolve(require('@jupyter-widgets/base7'));
} else {
// ipywidgets 8 model
requirePromise(['@jupyter-widgets/base']).then(resolve);
resolve(require('@jupyter-widgets/base'));
}
} else if (moduleName === '@jupyter-widgets/controls') {
const best = maxSatisfying(['1.5.0', '2.0.0'], moduleVersion);
Expand All @@ -138,7 +137,7 @@ export class HTMLManager extends ManagerBase {
) {
require('@jupyter-widgets/controls7/css/labvariables.css');
}
requirePromise(['@jupyter-widgets/controls7']).then(resolve);
resolve(require('@jupyter-widgets/controls7'));
} else {
// ipywidgets 8 controls JS and CSS
require('@jupyter-widgets/controls/css/widgets-base.css');
Expand All @@ -151,7 +150,8 @@ export class HTMLManager extends ManagerBase {
) {
require('@jupyter-widgets/controls/css/labvariables.css');
}
requirePromise(['@jupyter-widgets/controls']).then(resolve);

resolve(require('@jupyter-widgets/controls'));
}
} else if (moduleName === '@jupyter-widgets/output') {
resolve(outputWidgets);
Expand Down
2 changes: 1 addition & 1 deletion packages/html-manager/src/output_renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class WidgetRenderer extends Widget implements IRenderMime.IRenderer {
try {
const wModel = await this._manager.get_model(source.model_id);
const wView = await this._manager.create_view(wModel);
Widget.attach(wView.luminoWidget, this.node);
Widget.attach(wView.luminoWidget || wView.pWidget, this.node);
} catch (err) {
console.log('Error displaying widget');
console.log(err);
Expand Down
1 change: 0 additions & 1 deletion packages/html-manager/test/src/output_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ describe('Output widget', function () {
expect(elt.querySelectorAll('table').length).to.equal(1);
});


it('renders widgets ipywidgets 7', async function () {
const modelState = {
_view_module: '@jupyter-widgets/output',
Expand Down

0 comments on commit 45b4339

Please sign in to comment.