-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- #40 - #41 - "Open Popup" button for ipython iframes - column width resizing on sorting - additional int/float descriptors (sum, median, mode, var, sem, skew, kurt) - wordcloud chart type
- Loading branch information
Andrew Schonfeld
committed
Dec 23, 2019
1 parent
faeee73
commit aeaadac
Showing
19 changed files
with
520 additions
and
34 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
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,81 @@ | ||
import { mount } from "enzyme"; | ||
import _ from "lodash"; | ||
import React from "react"; | ||
|
||
import mockPopsicle from "../MockPopsicle"; | ||
import * as t from "../jest-assertions"; | ||
import { withGlobalJquery } from "../test-utils"; | ||
|
||
describe("WordcloudBody tests", () => { | ||
beforeAll(() => { | ||
const mockBuildLibs = withGlobalJquery(() => | ||
mockPopsicle.mock(url => { | ||
if (url.startsWith("chart-data-error-test1")) { | ||
return { data: {} }; | ||
} | ||
if (url.startsWith("chart-data-error-test2")) { | ||
return { error: "Error test." }; | ||
} | ||
const { urlFetcher } = require("../redux-test-utils").default; | ||
return urlFetcher(url); | ||
}) | ||
); | ||
|
||
const mockChartUtils = withGlobalJquery(() => (ctx, cfg) => { | ||
const chartCfg = { ctx, cfg, data: cfg.data, destroyed: false }; | ||
chartCfg.destroy = () => (chartCfg.destroyed = true); | ||
chartCfg.getElementsAtXAxis = _evt => [{ _index: 0 }]; | ||
return chartCfg; | ||
}); | ||
|
||
const mockD3Cloud = withGlobalJquery(() => () => { | ||
const cloudCfg = {}; | ||
const propUpdate = prop => val => { | ||
cloudCfg[prop] = val; | ||
return cloudCfg; | ||
}; | ||
cloudCfg.size = propUpdate("size"); | ||
cloudCfg.padding = propUpdate("padding"); | ||
cloudCfg.words = propUpdate("words"); | ||
cloudCfg.rotate = propUpdate("rotate"); | ||
cloudCfg.spiral = propUpdate("spiral"); | ||
cloudCfg.random = propUpdate("random"); | ||
cloudCfg.text = propUpdate("text"); | ||
cloudCfg.font = propUpdate("font"); | ||
cloudCfg.fontStyle = propUpdate("fontStyle"); | ||
cloudCfg.fontWeight = propUpdate("fontWeight"); | ||
cloudCfg.fontSize = () => ({ | ||
on: () => ({ start: _.noop }), | ||
}); | ||
return cloudCfg; | ||
}); | ||
|
||
jest.mock("popsicle", () => mockBuildLibs); | ||
jest.mock("d3-cloud", () => mockD3Cloud); | ||
jest.mock("chart.js", () => mockChartUtils); | ||
jest.mock("chartjs-plugin-zoom", () => ({})); | ||
jest.mock("chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.js", () => ({})); | ||
}); | ||
|
||
test("WordcloudBody missing data", done => { | ||
const WordcloudBody = require("../../popups/charts/WordcloudBody").default; | ||
|
||
const result = mount(<WordcloudBody chartType="wordcloud" data={{}} />, { | ||
attachTo: document.getElementById("content"), | ||
}); | ||
result.update(); | ||
t.notOk(result.html(), "shouldn't render anything"); | ||
done(); | ||
}); | ||
|
||
test("WordcloudBody invalid chartType type", done => { | ||
const WordcloudBody = require("../../popups/charts/WordcloudBody").default; | ||
|
||
const result = mount(<WordcloudBody chartType="bar" data={{}} />, { | ||
attachTo: document.getElementById("content"), | ||
}); | ||
result.update(); | ||
t.notOk(result.html(), "shouldn't render anything"); | ||
done(); | ||
}); | ||
}); |
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
Oops, something went wrong.