Skip to content

Commit

Permalink
Add viewer api for clear() and replace()
Browse files Browse the repository at this point in the history
  • Loading branch information
JHawk authored and texodus committed Feb 13, 2019
1 parent 3fa3bf2 commit 7e6dd2b
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 19 deletions.
23 changes: 23 additions & 0 deletions packages/perspective-viewer-highcharts/test/js/slow.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/******************************************************************************
*
* 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");
const path = require("path");

const mutation_tests = require("@jpmorganchase/perspective-viewer/test/js/mutation_tests.js");

utils.with_server({}, () => {
describe.page(
"line.html",
() => {
mutation_tests.default();
},
{root: path.join(__dirname, "..", "..")}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@
"line.html/highlights invalid filter.": "1dfcefa55fb5bad1804b1fbb708204de",
"treemap.html/highlights invalid filter.": "5b36e9d8a49d330118c2d6079262d268",
"heatmap.html/highlights invalid filter.": "1d1971aee71f389067e7f3c732d26a5f",
"null.html/should handle null categories in a pivot": "5574f2c3e83ed24577e5ce72626f175c"
"null.html/should handle null categories in a pivot": "5574f2c3e83ed24577e5ce72626f175c",
"line.html/replaces all rows.": "c799ce879d22a1ca89a6266575920d3a"
}
23 changes: 23 additions & 0 deletions packages/perspective-viewer-hypergrid/test/js/slow.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/******************************************************************************
*
* 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");
const path = require("path");

const mutation_tests = require("@jpmorganchase/perspective-viewer/test/js/mutation_tests.js");

utils.with_server({}, () => {
describe.page(
"superstore.html",
() => {
mutation_tests.default();
},
{root: path.join(__dirname, "..", "..")}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"regressions.html/saving a computed column does not interrupt update rendering": "da13afb4284b9c3da21ed57c6ba69301",
"empty.html/empty grids do not explode": "423ca653bbcbc21a28029c149a37b8ec",
"superstore.html/highlights invalid filter.": "e244cca8fc2278cb2477d0a46ab5331f",
"superstore.html/handles flush().": "a5d1bad309edf83ceef190dd19d867ec"
"superstore.html/handles flush().": "a5d1bad309edf83ceef190dd19d867ec",
"superstore.html/replaces all rows.": "2c41d623f03b2417da7b5dcf7f31e364"
}
29 changes: 29 additions & 0 deletions packages/perspective-viewer/test/js/mutation_tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/******************************************************************************
*
* 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.
*
*/

exports.default = function() {
test.capture("replaces all rows.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
const json = await page.evaluate(async element => {
let json = await element.view.to_json();
return json.slice(10, 20);
}, viewer);
expect(json.length).toEqual(10);
await page.evaluate(
async (element, json) => {
element.replace(json);
},
viewer,
json
);
// FIXME This is due to update() not triggering flush() semantics
await page.waitFor(1000);
});
};
17 changes: 0 additions & 17 deletions packages/perspective-viewer/test/js/simple_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,6 @@ exports.default = function() {
await page.evaluate(element => element.setAttribute("columns", '["Discount","Profit","Sales","Quantity"]'), viewer);
});

test.capture("replaces all rows.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
const json = await page.evaluate(async element => {
let json = await element.view.to_json();
return json.slice(10, 20);
}, viewer);
expect(json.length).toEqual(10);
await page.evaluate(
async (element, json) => {
element.replace(json);
},
viewer,
json
);
});

test.skip("pivots by row when drag-and-dropped.", async page => {
await page.shadow_click("perspective-viewer", "#config_button");
await drag_drop(page, "perspective-row[name=Category]", "#row_pivots");
Expand Down
23 changes: 23 additions & 0 deletions packages/perspective-viewer/test/js/slow.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/******************************************************************************
*
* 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("./utils.js");

const mutation_tests = require("./mutation_tests.js");
const path = require("path");

utils.with_server({}, () => {
describe.page(
"superstore.html",
() => {
mutation_tests.default();
},
{root: path.join(__dirname, "..", "..")}
);
});

0 comments on commit 7e6dd2b

Please sign in to comment.