-
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
9 changed files
with
79 additions
and
13 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
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,4 @@ | ||
x,y | ||
1,2 | ||
3,4 | ||
5,6 |
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,48 @@ | ||
/****************************************************************************** | ||
* | ||
* 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 path = require("path"); | ||
const puppeteer = require("puppeteer"); | ||
|
||
const { host } = require("../../src/js/index.js"); | ||
|
||
jest.setTimeout(30000); | ||
|
||
describe("CLI", function () { | ||
it("Tests something", async () => { | ||
const options = { port: 0 }; | ||
const server = await host("test/csv/test.csv", options); | ||
const port = server._server.address().port; | ||
console.log(port); | ||
|
||
const browser = await puppeteer.launch({ headless: true }); | ||
const page = await browser.newPage(); | ||
await page.goto(`http://localhost:${port}/`); | ||
await page.waitForSelector( | ||
"perspective-viewer perspective-viewer-datagrid" | ||
); | ||
|
||
const json = await page.evaluate(async function () { | ||
const viewer = document.querySelector("perspective-viewer"); | ||
const view = await viewer.getView(); | ||
return await view.to_json(); | ||
}); | ||
|
||
expect(json).toEqual([ | ||
{ x: 1, y: 2 }, | ||
{ x: 3, y: 4 }, | ||
{ x: 5, y: 6 }, | ||
]); | ||
|
||
await page.close(); | ||
await browser.close(); | ||
await new Promise((x) => setTimeout(x)); | ||
server.close(); | ||
}); | ||
}); |
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
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