Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Sep 13, 2019
1 parent 777c303 commit 079f2db
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/perspective-viewer-d3fc/test/results/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@
"sunburst.html/highlights invalid filter.": "e48566c24b1655a202d1d227424f71c5",
"sunburst.html/sorts by an alpha column.": "dca6a09d9b0c4b4a3fd6cdb91fa1eb1a",
"sunburst.html/displays visible columns.": "92769650f8ccaf823d070f3bd12aa73b",
"__GIT_COMMIT__": "13d836c9ddaa8374b884e9807f8a433c3fc53a6e"
"__GIT_COMMIT__": "22b09f8cad2692f94377e00577038e0c1683c7f3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@
"bar.html/perspective dispatches perspective-click event with one filter.": "32d64db28af46dfe77fad5cc1ca8af9c",
"bar.html/perspective dispatches perspective-click event with filters.": "c18f49270244dfe4a6b32270ec30d99d",
"bar.html/dates on the x-axis display correctly.": "591a1c8e9493451b6885b9651917ffff",
"__GIT_COMMIT__": "13d836c9ddaa8374b884e9807f8a433c3fc53a6e"
"__GIT_COMMIT__": "22b09f8cad2692f94377e00577038e0c1683c7f3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ module.exports = require("datasaur-local").extend("PerspectiveDataModel", {
_update_editor: function([rect]) {
const editor = this.grid.cellEditor;
let new_index;

if (editor) {
new_index = find_row(this.data, editor._index);
editor.event.resetGridXY(editor.event.dataCell.x, new_index - rect.origin.y + 1);
Expand Down
23 changes: 22 additions & 1 deletion packages/perspective-viewer-hypergrid/test/js/editing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,29 @@ utils.with_server({}, () => {
await page.keyboard.sendCharacter("2");
await page.keyboard.sendCharacter("A");
await page.keyboard.press("Enter");
await page.waitFor(100);
await page.waitFor(100); // wait for the invalid animation
await page.keyboard.press("Escape");
});

test.capture("should follow the indexed row when the data updates", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.waitForSelector("perspective-viewer[settings]");
await page.evaluate(async viewer => {
viewer.setAttribute("sort", '[["Sales", "desc"]]');
await viewer.flush();
}, viewer);
await page.waitForSelector("perspective-viewer:not([updating])");
await dblclick(page);
await page.keyboard.sendCharacter("a");
await page.keyboard.sendCharacter("b");
await page.keyboard.sendCharacter("c");
await page.keyboard.sendCharacter("d");
await page.evaluate(async viewer => {
const res = new Promise(x => viewer.addEventListener("perspective-view-update", () => x()));
viewer.update([{Sales: 100000}]);
await res;
}, viewer);
});
});
},
Expand Down
11 changes: 6 additions & 5 deletions packages/perspective-viewer-hypergrid/test/results/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
"superstore.html/shows a sort indicator": "5f4aae968d2dac96781c954e05d34303",
"superstore.html/shows multiple sort indicators": "b6f6bd22638f550ee07cadc46c1c37c0",
"superstore.html/shows a sort indicator on column split": "5391f996d29f1144d87ddc5f802e8c52",
"__GIT_COMMIT__": "13d836c9ddaa8374b884e9807f8a433c3fc53a6e",
"__GIT_COMMIT__": "bccac6a5526ff82f60168b522410d0bff2a7924e",
"superstore.html/should reinterpret metadata when only row pivots are changed": "fb9c5cb1b9a4148023f6edf4bffd27db",
"empty.html/perspective-click is fired when an empty dataset is loaded first": "7e5b653226145e1ab9f82e2417d89d7b",
"superstore.html/should not edit an immutable viewer": "8d99c2bc8bf7450a5f2cc4f5b1ca7412",
"editable.html/should save edits to a string column": "0f1e5aae7ca316d30e2926260fa4a049",
"editable.html/should save edits to an integer column": "81ef9bcde6197a213fba59ee33152c72",
"editable.html/should save edits of negative numbers to an integer column": "2007c3c6dc2b015f5e7e6223ad2c5be0",
"editable.html/should fail to save edits of invalid integers": "a0b7759a6a79313c676e25ae1af2a08b"
"editable.html/should save edits to a string column": "e1ccff5b0c2c15ee6363d1881f3a2754",
"editable.html/should save edits to an integer column": "0899c9636987608d306db60af44ec98f",
"editable.html/should save edits of negative numbers to an integer column": "81721a50fa662cc15818005b9fb85cd4",
"editable.html/should fail to save edits of invalid integers": "1f58c721fd26c7c71dae576f4a727de4",
"editable.html/should follow the indexed row when the data updates": "4028176406a2b3c43aa6e591056f7e9d"
}
2 changes: 1 addition & 1 deletion packages/perspective-viewer/test/results/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"superstore.html/saving a duplicate column should fail with error message.": "d9618357228698c5fbe9978b3ed1f668",
"superstore.html/highlights invalid filter.": "b31284a7b2a401d232ed077ec097a653",
"superstore.html/replaces all rows.": "7a7265b18d5c94f8f90abcad4f3f7781",
"__GIT_COMMIT__": "13d836c9ddaa8374b884e9807f8a433c3fc53a6e",
"__GIT_COMMIT__": "22b09f8cad2692f94377e00577038e0c1683c7f3",
"superstore.html/shows horizontal columns on small vertical viewports.": "05d7c917b5eb9e05387d52e3a6372c67",
"superstore.html/shows horizontal columns on small vertical and horizontal viewports.": "4cde889ccdbecba750e76f287707626f",
"superstore.html/user defined aggregates maintained on computed columns": "4047d2fd3b973a0492f805da9f604dbc"
Expand Down
24 changes: 19 additions & 5 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ function jest() {
}

if (args.indexOf("-t") > -1) {
const regex = args.slice(args.indexOf("-t") + 1).join(" ");
const regex = args
.slice(args.indexOf("-t") + 1)
.join(".")
.replace(/ /g, ".");
console.log(`-- Qualifying search '${regex}'`);
cmd += ` -t '${regex}'`;
cmd += ` -t "${regex}"`;
}

return (IS_WRITE ? "WRITE_TESTS=1 " : "") + cmd;
Expand Down Expand Up @@ -94,7 +97,15 @@ try {
}
if (!IS_EMSDK) {
execute(`yarn --silent clean --screenshots`);
execute(docker() + " " + args.join(" "));
execute(
docker() +
" " +
args
.map(function(arg) {
return "'" + arg.replace(/'/g, "'\\''") + "'";
})
.join(" ")
);
}
} else {
if (IS_LOCAL_PUPPETEER) {
Expand All @@ -118,8 +129,11 @@ try {
}
cmd += " -- yarn --silent test:run";
if (args.indexOf("-t") > -1) {
const regex = args.slice(args.indexOf("-t") + 1).join(" ");
console.log(`-- Qualifying search '${regex}'`);
let regex = args.slice(args.indexOf("-t") + 1);
const len = regex.findIndex(x => x.indexOf('"' > -1));
regex = regex.slice(0, len + 1);
console.log(`-- Qualifying search '${regex.join(" ")}'`);
regex = regex.join(".").replace(/ /g, ".");
cmd += ` -t "${regex}"`;
}
execute((IS_WRITE ? "WRITE_TESTS=1 " : "") + cmd);
Expand Down

0 comments on commit 079f2db

Please sign in to comment.