-
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.
- Loading branch information
Showing
7 changed files
with
264 additions
and
36 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
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
123 changes: 123 additions & 0 deletions
123
packages/perspective-workspace/test/js/integration/dom.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,123 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019, 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("@finos/perspective-test"); | ||
const path = require("path"); | ||
|
||
const TEST_ROOT = path.join(__dirname, "..", "..", ".."); | ||
const PATHS = [ | ||
path.join(TEST_ROOT, "dist", "umd"), | ||
path.join(TEST_ROOT, "dist", "themes"), | ||
path.join(TEST_ROOT, "test", "html"), | ||
path.join(TEST_ROOT, "test", "css"), | ||
path.join(TEST_ROOT, "test", "csv") | ||
]; | ||
|
||
utils.with_server({paths: PATHS}, () => { | ||
describe.page( | ||
"index.html", | ||
() => { | ||
describe("removeChild", () => { | ||
test.capture( | ||
"Remove One", | ||
async page => { | ||
await page.evaluate(() => { | ||
const viewer = document.createElement("perspective-viewer"); | ||
viewer.setAttribute("table", "superstore"); | ||
viewer.setAttribute("name", "one"); | ||
viewer.setAttribute("slot", "one"); | ||
const viewer2 = document.createElement("perspective-viewer"); | ||
viewer2.setAttribute("table", "superstore"); | ||
viewer2.setAttribute("name", "two"); | ||
viewer2.setAttribute("slot", "two"); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.appendChild(viewer); | ||
workspace.appendChild(viewer2); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
await page.evaluate(() => { | ||
const viewer = document.body.querySelector('perspective-viewer[name="one"]'); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.removeChild(viewer); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
}); | ||
|
||
describe("appendChild", () => { | ||
test.capture( | ||
"Create One", | ||
async page => { | ||
await page.evaluate(() => { | ||
const viewer = document.createElement("perspective-viewer"); | ||
viewer.setAttribute("table", "superstore"); | ||
viewer.setAttribute("slot", "one"); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.appendChild(viewer); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"Create multiple", | ||
async page => { | ||
await page.evaluate(() => { | ||
const viewer = document.createElement("perspective-viewer"); | ||
viewer.setAttribute("table", "superstore"); | ||
viewer.setAttribute("slot", "one"); | ||
const viewer2 = document.createElement("perspective-viewer"); | ||
viewer2.setAttribute("table", "superstore"); | ||
viewer2.setAttribute("slot", "two"); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.appendChild(viewer); | ||
workspace.appendChild(viewer2); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"With name", | ||
async page => { | ||
await page.evaluate(() => { | ||
const viewer = document.createElement("perspective-viewer"); | ||
viewer.setAttribute("table", "superstore"); | ||
viewer.setAttribute("name", "One"); | ||
viewer.setAttribute("slot", "one"); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.appendChild(viewer); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"Without slot", | ||
async page => { | ||
await page.evaluate(() => { | ||
const viewer = document.createElement("perspective-viewer"); | ||
viewer.setAttribute("table", "superstore"); | ||
const workspace = document.getElementById("workspace"); | ||
workspace.appendChild(viewer); | ||
}); | ||
await page.waitForSelector("perspective-workspace perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
}); | ||
}, | ||
{root: TEST_ROOT} | ||
); | ||
}); |
83 changes: 83 additions & 0 deletions
83
packages/perspective-workspace/test/js/integration/html.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,83 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019, 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("@finos/perspective-test"); | ||
const path = require("path"); | ||
|
||
const TEST_ROOT = path.join(__dirname, "..", "..", ".."); | ||
const PATHS = [ | ||
path.join(TEST_ROOT, "dist", "umd"), | ||
path.join(TEST_ROOT, "dist", "themes"), | ||
path.join(TEST_ROOT, "test", "html"), | ||
path.join(TEST_ROOT, "test", "css"), | ||
path.join(TEST_ROOT, "test", "csv") | ||
]; | ||
|
||
utils.with_server({paths: PATHS}, () => { | ||
describe.page( | ||
"index.html", | ||
() => { | ||
describe("HTML", () => { | ||
test.capture( | ||
"Create One", | ||
async page => { | ||
await page.evaluate(() => { | ||
document.body.innerHTML = ` | ||
<perspective-workspace> | ||
<perspective-viewer table="superstore"></perspective-viewer> | ||
</perspective-workspace> | ||
`; | ||
const workspace = document.body.querySelector("perspective-workspace"); | ||
workspace.tables.set("superstore", window.__TABLE__); | ||
}); | ||
await page.waitForSelector("perspective-workspace > perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"Create Multiple", | ||
async page => { | ||
await page.evaluate(() => { | ||
document.body.innerHTML = ` | ||
<perspective-workspace> | ||
<perspective-viewer table="superstore"></perspective-viewer> | ||
<perspective-viewer table="superstore"></perspective-viewer> | ||
</perspective-workspace> | ||
`; | ||
const workspace = document.body.querySelector("perspective-workspace"); | ||
workspace.tables.set("superstore", window.__TABLE__); | ||
}); | ||
await page.waitForSelector("perspective-workspace > perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"Create multiple with names", | ||
async page => { | ||
await page.evaluate(() => { | ||
document.body.innerHTML = ` | ||
<perspective-workspace> | ||
<perspective-viewer name="Table 1" table="superstore"></perspective-viewer> | ||
<perspective-viewer name="Table 2" table="superstore"></perspective-viewer> | ||
</perspective-workspace> | ||
`; | ||
const workspace = document.body.querySelector("perspective-workspace"); | ||
workspace.tables.set("superstore", window.__TABLE__); | ||
}); | ||
await page.waitForSelector("perspective-workspace > perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
}); | ||
}, | ||
{root: TEST_ROOT} | ||
); | ||
}); |
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
Oops, something went wrong.