-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from jpmorganchase/computed-update-fix
Fixed bug which caused computed-columns creation to break updates in …
- Loading branch information
Showing
7 changed files
with
128 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/perspective-viewer-hypergrid/test/html/regressions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- | ||
Copyright (c) 2017, the Perspective Authors. | ||
This file is part of the Perspective library, distributed under the terms of | ||
the Apache License 2.0. The full license can be found in the LICENSE file. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
||
<script src="perspective.view.js"></script> | ||
<script src="hypergrid.plugin.js"></script> | ||
|
||
<link rel='stylesheet' href="demo.css"> | ||
|
||
</head> | ||
<body> | ||
|
||
<perspective-viewer> | ||
|
||
</perspective-viewer> | ||
|
||
<script> | ||
|
||
var viewer = document.getElementsByTagName('perspective-viewer')[0]; | ||
viewer.load([ | ||
{x: 1, y: "a", z: true}, | ||
{x: 2, y: "b", z: false}, | ||
{x: 3, y: "c", z: true}, | ||
{x: 4, y: "a", z: false}, | ||
{x: 5, y: "b", z: true}, | ||
{x: 6, y: "c", z: false} | ||
], {index: 'x'}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
47 changes: 47 additions & 0 deletions
47
packages/perspective-viewer-hypergrid/test/js/regressions.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2017, the Perspective Authors. | ||
* | ||
* This file is part of the Perspective library, distributed under the terms of | ||
* the Apache License 2.0. The full license can be found in the LICENSE file. | ||
* | ||
*/ | ||
|
||
const utils = require("@jpmorganchase/perspective-viewer/test/js/utils.js"); | ||
|
||
async function capture_update(page, viewer, body) { | ||
await page.evaluate(element => { | ||
element.addEventListener("perspective-view-update", () => { | ||
element.setAttribute("test-updated", true); | ||
}); | ||
}, viewer); | ||
await body(); | ||
await page.waitFor(element => element.hasAttribute("test-updated"), {}, viewer); | ||
await page.evaluate(element => element.removeAttribute("test-updated"), viewer); | ||
} | ||
|
||
utils.with_server({}, () => { | ||
describe.page("regressions.html", () => { | ||
describe("Updates", () => { | ||
test.capture("regular updates", async page => { | ||
await page.click("#config_button"); | ||
const viewer = await page.$("perspective-viewer"); | ||
await capture_update(page, viewer, () => page.evaluate(element => element.update([{x: 3, y: "Updated!"}]), viewer)); | ||
await page.waitFor("perspective-viewer:not([updating])"); | ||
}); | ||
|
||
test.capture("saving a computed column does not interrupt update rendering", async page => { | ||
await page.click("#config_button"); | ||
const viewer = await page.$("perspective-viewer"); | ||
await page.click("#add-computed-column"); | ||
await page.$eval("perspective-computed-column", element => { | ||
const columns = [{name: "y", type: "string"}]; | ||
element._apply_state(columns, element.computations["length"], "new_cc"); | ||
}); | ||
await page.click("#psp-cc-button-save"); | ||
await page.waitForSelector("perspective-viewer:not([updating])"); | ||
await capture_update(page, viewer, () => page.evaluate(element => element.update([{x: 3, y: "Updated!"}]), viewer)); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters