Skip to content

Commit

Permalink
[chores] Maintain consistency across example styles
Browse files Browse the repository at this point in the history
  • Loading branch information
totallynotvaishnav committed Aug 20, 2022
1 parent d28bfee commit ac5dd94
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/netjsongraph.min.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/js/netjsongraph.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ const NetJSONGraphDefaultConfig = {
],
geoOptions: {
style: {
fillColor: "#d94f34",
color: "#d94f34",
weight: 2,
opacity: 1,
fillOpacity: 0.3,
radius: 10,
fillColor: "#1566a9",
weight: 0,
fillOpacity: 0.8,
radius: 8,
},
},
nodeCategories: [],
Expand Down Expand Up @@ -200,6 +198,7 @@ const NetJSONGraphDefaultConfig = {
* @this {object} The instantiated object of NetJSONGraph
*
*/
/* istanbul ignore next */
onReady() {},
};

Expand Down
32 changes: 32 additions & 0 deletions test/netjsongraph.render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,38 @@ describe("Test netjsongraph JSONDataUpdate", () => {
});
});

describe("Test deal data by worker", () => {
const eventData = {
data: JSONData,
};

window.Worker = jest.fn((url) => {
if (url === "worker.js") {
return {
postMessage: jest.fn(),
onmessage: jest.fn(),
addEventListener: jest.fn((event, callback) => {
if (event === "message") {
callback(eventData);
}
}),
};
}
return null;
});

beforeAll(() => {
graph.setConfig({
dealDataByWorker: "worker.js",
});
graph.render();
});

test("Should set the data property using worker", () => {
expect(graph.data).toEqual(eventData.data);
});
});

describe("Test netjsongraph JSONParamParse", () => {
test("Perform different operations to call NetJSONDataParse function according to different Param types.", () => {
const {JSONParamParse} = graph.utils;
Expand Down
9 changes: 9 additions & 0 deletions test/netjsongraph.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ describe("NetJSONGraph Specification", () => {
]);
expect(graph.config.mapOptions.nodeConfig).toBeInstanceOf(Object);
expect(graph.config.mapOptions.linkConfig).toBeInstanceOf(Object);
expect(graph.config.geoOptions).toBeInstanceOf(Object);
expect(graph.config.geoOptions).toEqual({
style: {
fillColor: "#1566a9",
weight: 0,
fillOpacity: 0.8,
radius: 8,
},
});
expect(graph.config.nodeCategories).toEqual([]);
expect(graph.config.linkCategories).toEqual([]);

Expand Down

0 comments on commit ac5dd94

Please sign in to comment.