Skip to content

Commit 3984689

Browse files
committed
let tests pass, build docs
1 parent ceb54c3 commit 3984689

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/components/PlotRender.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {h, withDirectives} from "vue";
44
class Document {
55
constructor() {
66
this.documentElement = new Element(this, "html");
7+
if (!globalThis.navigator) globalThis.navigator = {};
78
}
89
createElementNS(namespace, tagName) {
910
return new Element(this, tagName);

test/document-test.js

+14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ import {JSDOM} from "jsdom";
44

55
it("Plot.plot supports the document option", () => {
66
const {window} = new JSDOM("");
7+
global.navigator = window.navigator;
78
const svg = Plot.plot({document: window.document, marks: [Plot.barY([1, 2, 4, 3])]});
89
assert.strictEqual(svg.ownerDocument, window.document);
10+
delete global.navigator;
911
});
1012

1113
it("Plot.plot supports the document option for inline legends", () => {
1214
const {window} = new JSDOM("");
15+
global.navigator = window.navigator;
1316
const figure = Plot.plot({document: window.document, color: {legend: true}, marks: [Plot.cellX([1, 2, 4, 3])]});
1417
assert.strictEqual(figure.ownerDocument, window.document);
18+
delete global.navigator;
1519
});
1620

1721
it("mark.plot supports the document option", () => {
1822
const {window} = new JSDOM("");
23+
global.navigator = window.navigator;
1924
const svg = Plot.barY([1, 2, 4, 3]).plot({document: window.document});
2025
assert.strictEqual(svg.ownerDocument, window.document);
26+
delete global.navigator;
2127
});
2228

2329
it("Plot.legend supports the document option", () => {
@@ -29,32 +35,40 @@ it("Plot.legend supports the document option", () => {
2935
it("plot.legend supports the document option for quantitative color scales", () => {
3036
const {window: window1} = new JSDOM("");
3137
const {window: window2} = new JSDOM("");
38+
global.navigator = window1.navigator;
3239
const svg = Plot.plot({document: window1.document, marks: [Plot.cellX([1, 2, 4, 3])]}).legend("color", {
3340
document: window2.document
3441
});
3542
assert.strictEqual(svg.ownerDocument, window2.document);
43+
delete global.navigator;
3644
});
3745

3846
it("plot.legend inherits the document option", () => {
3947
const {window} = new JSDOM("");
48+
global.navigator = window.navigator;
4049
const svg = Plot.plot({document: window.document, marks: [Plot.cellX([1, 2, 4, 3])]}).legend("color");
4150
assert.strictEqual(svg.ownerDocument, window.document);
51+
delete global.navigator;
4252
});
4353

4454
it("plot.legend inherits the document option if that option is present but undefined", () => {
4555
const {window} = new JSDOM("");
56+
global.navigator = window.navigator;
4657
const svg = Plot.plot({document: window.document, marks: [Plot.cellX([1, 2, 4, 3])]}).legend("color", {
4758
document: undefined
4859
});
4960
assert.strictEqual(svg.ownerDocument, window.document);
61+
delete global.navigator;
5062
});
5163

5264
it("plot.legend supports the document option for categorical color scales", () => {
5365
const {window} = new JSDOM("");
66+
global.navigator = window.navigator;
5467
const svg = Plot.plot({
5568
document: window.document,
5669
color: {type: "categorical"},
5770
marks: [Plot.cellX([1, 2, 4, 3])]
5871
}).legend("color");
5972
assert.strictEqual(svg.ownerDocument, window.document);
73+
delete global.navigator;
6074
});

0 commit comments

Comments
 (0)