44 * you may not use this file except in compliance with the Elastic License.
55 */
66import { createMemoryHistory , History as HistoryPackageHistoryInterface } from 'history' ;
7- import copy from 'copy-to-clipboard' ;
87import { noAncestorsTwoChildrenWithRelatedEventsOnOrigin } from '../data_access_layer/mocks/no_ancestors_two_children_with_related_events_on_origin' ;
98import { Simulator } from '../test_utilities/simulator' ;
109// Extend jest with a custom matcher
@@ -14,10 +13,6 @@ import { urlSearch } from '../test_utilities/url_search';
1413// the resolver component instance ID, used by the react code to distinguish piece of global state from those used by other resolver instances
1514const resolverComponentInstanceID = 'resolverComponentInstanceID' ;
1615
17- jest . mock ( 'copy-to-clipboard' , ( ) => {
18- return jest . fn ( ) ;
19- } ) ;
20-
2116describe ( `Resolver: when analyzing a tree with no ancestors and two children and two related registry event on the origin, and when the component instance ID is ${ resolverComponentInstanceID } ` , ( ) => {
2217 /**
2318 * Get (or lazily create and get) the simulator.
@@ -121,8 +116,8 @@ describe(`Resolver: when analyzing a tree with no ancestors and two children and
121116
122117 copyableFields ?. map ( ( copyableField ) => {
123118 copyableField . simulate ( 'mouseenter' ) ;
124- simulator ( ) . testSubject ( 'clipboard' ) . last ( ) . simulate ( 'click' ) ;
125- expect ( copy ) . toHaveBeenLastCalledWith ( copyableField . text ( ) , expect . any ( Object ) ) ;
119+ simulator ( ) . testSubject ( 'resolver:panel: clipboard' ) . last ( ) . simulate ( 'click' ) ;
120+ expect ( navigator . clipboard . writeText ) . toHaveBeenCalledWith ( copyableField . text ( ) ) ;
126121 copyableField . simulate ( 'mouseleave' ) ;
127122 } ) ;
128123 } ) ;
@@ -179,8 +174,8 @@ describe(`Resolver: when analyzing a tree with no ancestors and two children and
179174
180175 copyableFields ?. map ( ( copyableField ) => {
181176 copyableField . simulate ( 'mouseenter' ) ;
182- simulator ( ) . testSubject ( 'clipboard' ) . last ( ) . simulate ( 'click' ) ;
183- expect ( copy ) . toHaveBeenLastCalledWith ( copyableField . text ( ) , expect . any ( Object ) ) ;
177+ simulator ( ) . testSubject ( 'resolver:panel: clipboard' ) . last ( ) . simulate ( 'click' ) ;
178+ expect ( navigator . clipboard . writeText ) . toHaveBeenCalledWith ( copyableField . text ( ) ) ;
184179 copyableField . simulate ( 'mouseleave' ) ;
185180 } ) ;
186181 } ) ;
@@ -288,8 +283,8 @@ describe(`Resolver: when analyzing a tree with no ancestors and two children and
288283
289284 copyableFields ?. map ( ( copyableField ) => {
290285 copyableField . simulate ( 'mouseenter' ) ;
291- simulator ( ) . testSubject ( 'clipboard' ) . last ( ) . simulate ( 'click' ) ;
292- expect ( copy ) . toHaveBeenLastCalledWith ( copyableField . text ( ) , expect . any ( Object ) ) ;
286+ simulator ( ) . testSubject ( 'resolver:panel: clipboard' ) . last ( ) . simulate ( 'click' ) ;
287+ expect ( navigator . clipboard . writeText ) . toHaveBeenCalledWith ( copyableField . text ( ) ) ;
293288 copyableField . simulate ( 'mouseleave' ) ;
294289 } ) ;
295290 } ) ;
0 commit comments