@@ -2,11 +2,10 @@ import { jest } from "@jest/globals";
22
33import { TBlock } from "../../components/canvas/blocks/Block" ;
44import { Graph } from "../../graph" ;
5- import { SelectionEvent } from "../../graphEvents" ;
5+ import { GraphEventsDefinitions } from "../../graphEvents" ;
66import { ESelectionStrategy } from "../../services/selection/types" ;
77import { EAnchorType } from "../anchor/Anchor" ;
88
9- import { TBlockId } from "./Block" ;
109import { BlockListStore } from "./BlocksList" ;
1110
1211const generateBlock = ( ) : TBlock => {
@@ -150,16 +149,16 @@ describe("Blocks selection", () => {
150149 it . todo ( "Should emit event on select anchor" ) ;
151150
152151 it ( "Should emit blocks-selection-change event with correct params" , ( ) => {
153- const handler = jest . fn ( ) ;
152+ const handler = jest . fn < GraphEventsDefinitions [ "blocks-selection-change" ] > ( ) ;
154153 graph . on ( "blocks-selection-change" , handler ) ;
155154
156155 store . updateBlocksSelection ( [ block1 . id ] , true ) ;
157156
158157 expect ( handler ) . toHaveBeenCalledTimes ( 1 ) ;
159158 const eventArg = handler . mock . calls [ 0 ] [ 0 ] ;
160159 // Проверяем, что в eventArg есть нужные id
161- expect ( ( eventArg as SelectionEvent < TBlockId > ) . detail . changes . add ) . toEqual ( [ block1 . id ] ) ;
162- expect ( ( eventArg as SelectionEvent < TBlockId > ) . detail . changes . removed ) . toEqual ( [ ] ) ;
160+ expect ( eventArg . detail . changes . add ) . toEqual ( [ block1 . id ] ) ;
161+ expect ( eventArg . detail . changes . removed ) . toEqual ( [ ] ) ;
163162 } ) ;
164163
165164 it ( "Should prevent selection change if preventDefault called" , ( ) => {
@@ -208,7 +207,7 @@ describe("Anchors selection", () => {
208207 } ) ;
209208
210209 it ( "Should emit block-anchor-selection-change event with correct params" , ( ) => {
211- const handler = jest . fn ( ) ;
210+ const handler = jest . fn < GraphEventsDefinitions [ "block-anchor-selection-change" ] > ( ) ;
212211 graph . on ( "block-anchor-selection-change" , handler ) ;
213212
214213 store . setAnchorSelection ( block . id , anchorId , true ) ;
0 commit comments