Skip to content

Commit 9725b22

Browse files
committed
【fix】空值判断 fix ut
1 parent 4bad845 commit 9725b22

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

src/common/overlay/KnowledgeGraph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ export class KnowledgeGraph {
608608
*/
609609
expandNode(id) {
610610
const item = this.findById(id);
611-
this.graphRender.expandNode(item);
611+
item && this.graphRender.expandNode(item);
612612
}
613613

614614
/**
@@ -619,7 +619,7 @@ export class KnowledgeGraph {
619619
*/
620620
collapseNode(id) {
621621
const item = this.findById(id);
622-
this.graphRender.collapseNode(item);
622+
item && this.graphRender.collapseNode(item);
623623
}
624624

625625
/**

test/leaflet/overlay/GraphMapSpec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ describe('GraphMap leaflet', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
expect(graphMap).not.toBeNull();
41-
done();
40+
graphMap.on('loaded',()=>{
41+
expect(graphMap).not.toBeNull();
42+
done();
43+
})
44+
4245
});
4346
});

test/mapboxgl/overlay/GraphMapSpec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ describe('GraphMap mapboxgl', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
expect(graphMap).not.toBeNull();
41-
done();
40+
graphMap.on('loaded',()=>{
41+
expect(graphMap).not.toBeNull();
42+
done();
43+
})
4244
});
4345
});

test/maplibregl/overlay/GraphMapSpec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ describe('GraphMap leaflet', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
expect(graphMap).not.toBeNull();
41-
done();
40+
graphMap.on('loaded',()=>{
41+
expect(graphMap).not.toBeNull();
42+
done();
43+
})
4244
});
4345
});

test/openlayers/overlay/GraphMapSpec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ describe('GraphMap openlayers', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
expect(graphMap).not.toBeNull();
41-
done();
40+
graphMap.on('loaded',()=>{
41+
expect(graphMap).not.toBeNull();
42+
done();
43+
})
4244
});
4345
});

0 commit comments

Comments
 (0)