Skip to content

Commit ac91a83

Browse files
committed
fix projectionClipAngle test, take 3
1 parent 709d416 commit ac91a83

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

test/output/projectionClipAngle.svg

Lines changed: 2 additions & 2 deletions
Loading

test/plot.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import it from "./jsdom.js";
88
import * as plots from "./plots/index.ts"; // TODO index.js
99

1010
for (const [name, plot] of Object.entries(plots)) {
11-
if (name !== "projectionClipAngle") continue;
12-
it.only(`plot ${name}`, async () => {
11+
it(`plot ${name}`, async () => {
1312
const root = await (name.startsWith("warn") ? assert.warnsAsync : assert.doesNotWarnAsync)(plot);
1413
const ext = root.tagName === "svg" ? "svg" : "html";
1514
for (const svg of root.tagName === "svg" ? [root] : root.querySelectorAll("svg")) {

test/plots/projection-clip-angle.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,10 @@ import {feature} from "topojson-client";
55
export async function projectionClipAngle() {
66
const world = await d3.json<any>("data/countries-50m.json");
77
const domain = feature(world, world.objects.land);
8-
const svg = Plot.plot({
8+
return Plot.plot({
99
width: 600,
1010
height: 600,
11-
projection: {type: "azimuthal-equidistant", clip: 30, rotate: [0, 90], domain: {type: "Sphere"}},
11+
projection: {type: "azimuthal-equidistant", clip: 30, rotate: [0, 89.9], domain: {type: "Sphere"}},
1212
marks: [Plot.graticule(), Plot.geo(domain, {fill: "currentColor"}), Plot.sphere()]
1313
});
14-
cleanPaths(svg);
15-
return svg;
16-
}
17-
18-
// Due to numerical instabilities, paths are inconsistent across architectures.
19-
// This removes some invisible paths to get this test to pass consistently.
20-
function cleanPaths(svg: SVGSVGElement | HTMLElement) {
21-
for (const path of svg.querySelectorAll("[fill=none] path")) {
22-
const d = path.getAttribute("d");
23-
path.setAttribute("d", d.replace(/M\d+(?:\.\d+)?,\d+(?:\.\d+)?L\d+(?:\.\d+)?,\d+(?:\.\d+)?(?=M)/g, ""));
24-
}
2514
}

0 commit comments

Comments
 (0)