@@ -787,12 +787,13 @@ describe('KnowledgeGraph', () => {
787787 var graph = new KnowledgeGraph ( { nodeLabelMaxWidth : 100 } ) ;
788788 spyOn ( graph . graph , 'setItemState' ) ;
789789 spyOn ( graph . graph , 'clearItemStates' ) ;
790- graph . graph . emit ( 'node:mouseenter' , { a : 'heloooo' } ) ;
790+
791+ graph . graph . emit ( 'node:mouseenter' , { item : { test : 'heloooo' } } ) ;
791792 expect ( graph . graph . setItemState ) . toHaveBeenCalled ( ) ;
792793 graph . graph . emit ( 'node:mouseleave' ) ;
793794 expect ( graph . graph . clearItemStates ) . toHaveBeenCalled ( ) ;
794795
795- graph . graph . emit ( 'edge:mouseenter' ) ;
796+ graph . graph . emit ( 'edge:mouseenter' , { item : { test : 'heloooo' } } ) ;
796797 expect ( graph . graph . setItemState ) . toHaveBeenCalled ( ) ;
797798 graph . graph . emit ( 'edge:mouseleave' ) ;
798799 expect ( graph . graph . clearItemStates ) . toHaveBeenCalled ( ) ;
@@ -801,6 +802,9 @@ describe('KnowledgeGraph', () => {
801802
802803 it ( 'highlight' , ( done ) => {
803804 var graph = new KnowledgeGraph ( { nodeLabelMaxWidth : 100 } ) ;
805+ spyOn ( graph . graph , 'setItemState' ) ;
806+ spyOn ( graph . graph , 'updateItem' ) ;
807+
804808 var highlightStateStyles = {
805809 nodeStateStyles : {
806810 lineWidth : 3 ,
@@ -816,42 +820,35 @@ describe('KnowledgeGraph', () => {
816820 }
817821 }
818822 } ;
819- graph . highlight ( { nodeIDs : [ 1 ] , edgeIDs : [ 2 ] , ...highlightStateStyles } ) ;
820- graph . findById = ( ) => true ;
821- graph . find = ( ) => true ;
822823
823- spyOn ( graph . graph , 'setItemState' ) ;
824- spyOn ( graph . graph , 'updateItem' ) ;
825-
826- expect ( graph . graph . setItemState ) . toHaveBeenCalled ( ) ;
827- expect ( graph . graph . updateItem ) . toHaveBeenCalled ( ) ;
828-
829- graph . highlight ( { nodeIDs : [ 3 ] , edgeIDs : [ 4 ] } ) ;
830824 graph . findById = ( ) => false ;
831825 graph . find = ( ) => false ;
826+ graph . highlight ( { nodeIDs : [ 3 ] , edgeIDs : [ 4 ] } ) ;
832827 expect ( graph . graph . setItemState ) . not . toHaveBeenCalled ( ) ;
833828
829+ graph . findById = ( ) => true ;
830+ graph . find = ( ) => true ;
831+ graph . highlight ( { nodeIDs : [ 1 ] , edgeIDs : [ 2 ] , ...highlightStateStyles } ) ;
832+
833+ expect ( graph . graph . setItemState ) . toHaveBeenCalled ( ) ;
834+ expect ( graph . graph . updateItem ) . toHaveBeenCalled ( ) ;
834835 done ( ) ;
835836 } ) ;
836837
837838 it ( 'clearHighlight' , ( done ) => {
838839 var graph = new KnowledgeGraph ( { nodeLabelMaxWidth : 100 } ) ;
839840 spyOn ( graph . graph , 'clearItemStates' ) ;
840841
841- graph . clearHighlight ( { nodeIDs : [ 1 ] , edgeIDs : [ 2 ] } ) ;
842- graph . findById = ( ) => true ;
843- graph . find = ( ) => true ;
844- expect ( graph . graph . clearItemStates ) . toHaveBeenCalled ( ) ;
845-
846- graph . clearHighlight ( { nodeIDs : [ 3 ] , edgeIDs : [ 4 ] } ) ;
847842 graph . findById = ( ) => false ;
848843 graph . find = ( ) => false ;
844+ graph . clearHighlight ( { nodeIDs : [ 3 ] , edgeIDs : [ 4 ] } ) ;
849845 expect ( graph . graph . clearItemStates ) . not . toHaveBeenCalled ( ) ;
850846
851- graph . getNodes = ( ) => [ true ] ;
852- graph . getEdges = ( ) => [ true ] ;
847+ graph . findById = ( ) => true ;
848+ graph . find = ( ) => true ;
849+ graph . clearHighlight ( { nodeIDs : [ 1 ] , edgeIDs : [ 2 ] } ) ;
850+ expect ( graph . graph . clearItemStates ) . toHaveBeenCalled ( ) ;
853851 graph . clearHighlight ( ) ;
854-
855852 expect ( graph . graph . clearItemStates ) . toHaveBeenCalled ( ) ;
856853 done ( ) ;
857854 } ) ;
0 commit comments