Skip to content

Commit

Permalink
Fix Jupyter widget plugin switch
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Stein <[email protected]>
  • Loading branch information
texodus committed Nov 6, 2024
1 parent 00137e3 commit 1945b40
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions packages/perspective-jupyterlab/test/jupyter/widget.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,52 @@ perpsective.PerspectiveWidget(df, **config)
expect(errored).toBe(false);
});

test_jupyter(
"Toggles to datagrid and back regression",
[
"w = perspective.widget.PerspectiveWidget(arrow_data, columns=['f64', 'str', 'datetime'])",
"w",
],
async ({ page }) => {
await default_body(page);
const num_columns = await page
.locator("regular-table thead tr")
.first()
.evaluate((tr) => tr.childElementCount);

async function toggle(plugin) {
await page.locator(".plugin-select-item").click();
await page
.locator("#plugin_selector_container.open")
.waitFor();

await page
.locator(`[data-plugin=${plugin}].plugin-select-item`)
.click();

await page
.locator("#plugin_selector_container:not(.open)")
.waitFor();

await page.evaluate(async () => {
await document
.querySelector("perspective-viewer")!
.flush();
});
}

await toggle('"X/Y Line"');
await toggle("Datagrid");
await toggle('"X/Y Line"');
await toggle("Datagrid");

// expect(num_columns).toEqual(3);
await expect(
page.locator("regular-table tbody tr")
).toHaveCount(5);
}
);

// *************************
// UTILS
// *************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function toggle_edit_mode(mode = undefined) {
}

this.model._edit_mode = mode;
this.parentElement.setSelection();
this.parentElement?.setSelection();
this.model._selection_state = {
selected_areas: [],
dirty: true,
Expand Down

0 comments on commit 1945b40

Please sign in to comment.