-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathviewnotfound.spec.js
More file actions
87 lines (73 loc) · 4.07 KB
/
viewnotfound.spec.js
File metadata and controls
87 lines (73 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
// ┃ This file is part of the Perspective library, distributed under the terms ┃
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
import { test, expect } from "@perspective-dev/test";
test("View conflation is silenced", async ({ page }) => {
await page.goto(
"/rust/perspective-viewer/test/html/superstore_lazy_viewer.html",
);
await page.evaluate(async () => {
while (!window["__TEST_PERSPECTIVE_READY__"]) {
await new Promise((x) => setTimeout(x, 10));
}
});
let vnf = false;
page.on("console", (msg) => {
if (msg.type() === "error") {
if (msg.text().includes("View not found")) {
vnf = true;
}
}
});
await page.evaluate(async () => {
const worker = window.__TEST_WORKER__;
let resolve;
let is_paused = false;
const BasePlugin = customElements.get("perspective-viewer-plugin");
class PausePlugin extends BasePlugin {
get name() {
return "pause-plugin";
}
async draw(view) {
if (is_paused) {
await new Promise((x) => {
resolve = x;
});
}
const size = await view.num_rows();
this.textContent = `Rows: ${size}`;
}
}
customElements.define("pause-plugin", PausePlugin);
const Viewer = customElements.get("perspective-viewer");
Viewer.registerPlugin("pause-plugin");
// use a new viewer because only new viewers get loaded with the registered plugin
const viewer = document.createElement("perspective-viewer");
document.body.append(viewer);
worker.table("a,b,c\n1,2,3", { name: "A" });
await viewer.load(worker);
await viewer.restore({ table: "A", plugin: "pause-plugin" });
is_paused = true;
// Change in 4.1.0 - empty restore now does not render
const restore_task = viewer.restore({
plugin: "pause-plugin",
});
while (!resolve) {
await new Promise((x) => setTimeout(x, 0));
}
await new Promise((x) => setTimeout(x, 0));
resolve();
resolve = undefined;
is_paused = false;
await restore_task;
});
expect(vnf).toBeFalsy();
});