Skip to content

Commit

Permalink
Ported to Yew, reimplemented split-panel
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Feb 20, 2021
1 parent 9f50aa6 commit 7dc62a7
Show file tree
Hide file tree
Showing 59 changed files with 2,139 additions and 1,781 deletions.
6 changes: 3 additions & 3 deletions packages/perspective-jupyterlab/test/js/resize.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ utils.with_server({}, () => {
test.capture(
"Basic widget functions",
async page => {
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.waitForSelector("perspective-viewer[settings]");
await page.waitForSelector("perspective-viewer:not([updating])");
},
Expand All @@ -27,7 +27,7 @@ utils.with_server({}, () => {
test.capture(
"Resize the container causes the widget to resize",
async page => {
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.waitForSelector("perspective-viewer:not([updating])");
await page.evaluate(async () => {
document.querySelector(".PSPContainer").style = "position:absolute;top:0;left:0;width:300px;height:300px";
Expand All @@ -45,7 +45,7 @@ utils.with_server({}, () => {
test.capture(
"row_pivots traitlet works",
async page => {
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(() => {
window.__WIDGET__.row_pivots = ["State"];
});
Expand Down
3 changes: 1 addition & 2 deletions packages/perspective-test/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,9 @@ test.capture = function capture(name, body, {timeout = 60000, viewport = null, w
} else {
await page.evaluate(async x => {
const viewer = document.querySelector("perspective-viewer");
viewer._show_config = true;
viewer.restore(x);
await viewer.notifyResize();
await viewer.toggleConfig();
await viewer.toggleConfig(false);
}, OLD_SETTINGS[test_root + _url]);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/perspective-viewer-d3fc/src/less/chart.less
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@

& .x-label {
height: 1.2em !important;
line-height: 1em !important;
}

& d3fc-canvas.plot-area {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ utils.with_server({}, () => {

test.capture("filter to date range.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("column-pivots", '["Name"]'), viewer);
await page.evaluate(element => element.setAttribute("filters", '[["Date", ">", "2019-01-01"]]'), viewer);
await page.evaluate(() => document.activeElement.blur());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ utils.with_server({}, () => {

test.capture("Sets a category axis when pivoted by a computed datetime", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("computed-columns", JSON.stringify(["hour_bucket('Ship Date')"])), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
await page.evaluate(element => element.setAttribute("row-pivots", '["hour_bucket(Ship Date)"]'), viewer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ utils.with_server({}, () => {

test.capture("filter to date range.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("column-pivots", '["Name"]'), viewer);
await page.evaluate(element => element.setAttribute("filters", '[["Date", ">", "2019-01-01"]]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ utils.with_server({}, () => {
"tooltips with no color and size.",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit", null, null, "Quantity"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
const columns = JSON.parse(await page.evaluate(element => element.getAttribute("columns"), viewer));
Expand All @@ -51,7 +51,7 @@ utils.with_server({}, () => {
"tooltip columns works",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit", "Discount", "Quantity", "State"]'), viewer);
const columns = JSON.parse(await page.evaluate(element => element.getAttribute("columns"), viewer));
expect(columns).toEqual(["Sales", "Profit", "Discount", "Quantity", "State"]);
Expand All @@ -77,7 +77,7 @@ utils.with_server({}, () => {
"tooltip columns works when color column is null",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit", null, "Quantity", "State"]'), viewer);
const columns = JSON.parse(await page.evaluate(element => element.getAttribute("columns"), viewer));
expect(columns).toEqual(["Sales", "Profit", null, "Quantity", "State"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ utils.with_server({}, () => {

test.skip("sunburst label shows formatted date", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["Ship Date"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit"]'), viewer);
await page.evaluate(element => element.setAttribute("filters", '[["Product ID", "==", "FUR-BO-10001798"]]'), viewer);
Expand All @@ -45,7 +45,7 @@ utils.with_server({}, () => {

test.skip("sunburst parent button shows formatted date", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["Ship Date", "City"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit"]'), viewer);
await page.evaluate(element => element.setAttribute("filters", '[["Product ID", "==", "FUR-BO-10001798"]]'), viewer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ utils.with_server({}, () => {
"with column position 1 set to null.",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["State"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", null, "Quantity"]'), viewer);
const columns = JSON.parse(await page.evaluate(element => element.getAttribute("columns"), viewer));
Expand All @@ -38,7 +38,7 @@ utils.with_server({}, () => {
"tooltip columns works",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["State"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit", "State"]'), viewer);
const columns = JSON.parse(await page.evaluate(element => element.getAttribute("columns"), viewer));
Expand All @@ -65,7 +65,7 @@ utils.with_server({}, () => {
"treemap label shows formatted date",
async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["Ship Date"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
Expand All @@ -75,7 +75,7 @@ utils.with_server({}, () => {

test.skip("treemap parent button shows formatted date", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["Ship Date", "Ship Mode"]'), viewer);
await page.evaluate(element => element.setAttribute("columns", '["Sales", "Profit"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
"treemap_pivots_by_a_row_": "c5d7eaebd161205e5a2d106a635fa4a5",
"treemap_pivots_by_two_rows_": "d53fc9cbf1c3ba82a80a099c84288048",
"treemap_pivots_by_a_column_": "1b57aca80b9495c7b866de0656777990",
"treemap_pivots_by_a_row_and_a_column_": "7a11c95626c72cdee1d30dab5a6c5a1a",
"treemap_pivots_by_two_rows_and_two_columns_": "b74e47e2d31817be0a989fa9e16d54d6",
"treemap_pivots_by_a_row_and_a_column_": "5e1753eca1af5cd4bc3b4985ec609f2c",
"treemap_pivots_by_two_rows_and_two_columns_": "a4b00806e97899d5a1420f53d0adc09a",
"treemap_sorts_by_a_hidden_column_": "a24671528348e3d960a290bd12845f17",
"treemap_sorts_by_a_numeric_column_": "3cc8682c3f574d9bf726fa498a33461a",
"treemap_filters_by_a_numeric_column_": "de32cdf7b7008ac9883859b8e8a90a92",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ utils.with_server({}, () => {

test.capture("resets viewable area when the logical size expands.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("column-pivots", '["Category"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
await page.evaluate(element => element.setAttribute("row-pivots", '["City"]'), viewer);
});

test.capture("resets viewable area when the physical size expands.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["Category"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
await page.evaluate(element => element.setAttribute("row-pivots", "[]"), viewer);
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
});

test.capture("perspective dispatches perspective-click event with correct details", async page => {
Expand Down Expand Up @@ -66,7 +66,7 @@ utils.with_server({}, () => {

test.capture("perspective dispatches perspective-click event with correct details when filter is set", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(async () => await document.querySelector("perspective-viewer").toggleConfig());
await page.evaluate(element => element.setAttribute("row-pivots", '["State", "Category"]'), viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
const detail = await click_details(page, 310, 320);
Expand Down
3 changes: 2 additions & 1 deletion packages/perspective-viewer/src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default () => {
{
input: "src/js/viewer.js",
external: id => {
// `@finos/perspective-vieux` is inlined for now. So we need to bundle:
// `@finos/perspective-vieux` is inlined for now. So we need to
// bundle:
// * Files in this package (starting with '.')
// * Anything else in the package root ..
// * .. including the inlined `@finos/perspective-vieux` ..
Expand Down
Loading

0 comments on commit 7dc62a7

Please sign in to comment.