Compare commits

...

3 Commits

Author SHA1 Message Date
sunilyadav840
ccac4b8741 revert changes 2021-09-28 19:49:26 +05:30
sunilyadav840
0e841e34a6 Merge branch 'master' 2021-09-28 19:36:01 +05:30
sunilyadav840
b4cc0f8e52 fixed test cases errors 2021-05-05 17:59:54 +05:30
6 changed files with 35 additions and 23 deletions

View File

@@ -88,6 +88,7 @@ export class IndexingPolicyComponent extends React.Component<
private async createIndexingPolicyEditor(): Promise<void> { private async createIndexingPolicyEditor(): Promise<void> {
const value: string = JSON.stringify(this.props.indexingPolicyContent, undefined, 4); const value: string = JSON.stringify(this.props.indexingPolicyContent, undefined, 4);
const monaco = await loadMonaco(); const monaco = await loadMonaco();
if (monaco.editor) {
this.indexingPolicyEditor = monaco.editor.create(this.indexingPolicyDiv.current, { this.indexingPolicyEditor = monaco.editor.create(this.indexingPolicyDiv.current, {
value: value, value: value,
language: "json", language: "json",
@@ -100,6 +101,7 @@ export class IndexingPolicyComponent extends React.Component<
this.props.logIndexingPolicySuccessMessage(); this.props.logIndexingPolicySuccessMessage();
} }
} }
}
private onEditorContentChange = (): void => { private onEditorContentChange = (): void => {
const indexingPolicyEditorModel = this.indexingPolicyEditor.getModel(); const indexingPolicyEditorModel = this.indexingPolicyEditor.getModel();

View File

@@ -138,17 +138,19 @@ describe("D3ForceGraph", () => {
it("should call onHighlightedNode callback when mouse hovering over node", () => { it("should call onHighlightedNode callback when mouse hovering over node", () => {
forceGraph.params.onGraphUpdated = () => { forceGraph.params.onGraphUpdated = () => {
if (document) {
const mouseoverEvent = document.createEvent("Events"); const mouseoverEvent = document.createEvent("Events");
mouseoverEvent.initEvent("mouseover", true, false); mouseoverEvent.initEvent("mouseover", true, false);
$(rootNode).find(".node")[0].dispatchEvent(mouseoverEvent); // [0] is v1 vertex $(rootNode).find(".node")[0].dispatchEvent(mouseoverEvent); // [0] is v1 vertex
expect($(rootNode).find(".node")[0]).toBe(1);
// onHighlightedNode is always called once to clear the selection // onHighlightedNode is always called once to clear the selection
expect((forceGraph.params.onHighlightedNode as sinon.SinonSpy).calledTwice).toBe(true); expect((forceGraph.params.onHighlightedNode as sinon.SinonSpy).calledTwice).toBe(true);
const onHighlightedNode = (forceGraph.params.onHighlightedNode as sinon.SinonSpy).args[1][0] as D3GraphNodeData; const onHighlightedNode = (forceGraph.params.onHighlightedNode as sinon.SinonSpy)
.args[1][0] as D3GraphNodeData;
expect(onHighlightedNode).not.toBe(null); expect(onHighlightedNode).not.toBe(null);
expect(onHighlightedNode.id).toEqual(v1Id); expect(onHighlightedNode.id).toEqual(v1Id);
}
}; };
forceGraph.updateGraph(newGraph, forceGraph.igraphConfig); forceGraph.updateGraph(newGraph, forceGraph.igraphConfig);

View File

@@ -1084,7 +1084,6 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
public static reportToConsole(type: ConsoleDataType, msg: string, ...errorData: any[]): void | (() => void) { public static reportToConsole(type: ConsoleDataType, msg: string, ...errorData: any[]): void | (() => void) {
let errorDataStr: string = ""; let errorDataStr: string = "";
if (errorData && errorData.length > 0) { if (errorData && errorData.length > 0) {
console.error(msg, errorData);
errorDataStr = ": " + JSON.stringify(errorData); errorDataStr = ": " + JSON.stringify(errorData);
} }

View File

@@ -22,7 +22,7 @@ export class MiddlePaneComponent extends React.Component<MiddlePaneComponentProp
onClick={this.props.toggleExpandGraph} onClick={this.props.toggleExpandGraph}
role="button" role="button"
aria-expanded={this.props.isTabsContentExpanded} aria-expanded={this.props.isTabsContentExpanded}
aria-name="View graph in full screen" aria-label="View graph in full screen"
tabIndex={0} tabIndex={0}
> >
<img <img

View File

@@ -78,7 +78,7 @@ export default class NotebookManager {
this.notebookContentProvider = new NotebookContentProvider( this.notebookContentProvider = new NotebookContentProvider(
this.inMemoryContentProvider, this.inMemoryContentProvider,
this.gitHubContentProvider, this.gitHubContentProvider,
contents.JupyterContentProvider contents?.JupyterContentProvider
); );
this.notebookClient = new NotebookContainerClient(() => this.notebookClient = new NotebookContainerClient(() =>

View File

@@ -1,7 +1,7 @@
import { initializeIcons } from "@fluentui/react";
import { configure } from "enzyme"; import { configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16"; import Adapter from "enzyme-adapter-react-16";
import "jest-canvas-mock"; import "jest-canvas-mock";
import { initializeIcons } from "@fluentui/react";
import { TextDecoder, TextEncoder } from "util"; import { TextDecoder, TextEncoder } from "util";
configure({ adapter: new Adapter() }); configure({ adapter: new Adapter() });
initializeIcons(); initializeIcons();
@@ -16,3 +16,12 @@ if (typeof window.URL.createObjectURL === "undefined") {
require("jquery-ui-dist/jquery-ui"); require("jquery-ui-dist/jquery-ui");
(<any>global).TextEncoder = TextEncoder; (<any>global).TextEncoder = TextEncoder;
(<any>global).TextDecoder = TextDecoder; (<any>global).TextDecoder = TextDecoder;
// In Node v7 unhandled promise rejections
if (process.env.LISTENING_TO_UNHANDLED_REJECTION !== "true") {
process.on("unhandledRejection", (reason) => {
console.error("reason", reason);
});
// Avoid memory leak by adding too many listeners
process.env.LISTENING_TO_UNHANDLED_REJECTION = "true";
}