MCPcopy
hub / github.com/palantir/blueprint / checkClickTriggeredOnKeyUp

Function checkClickTriggeredOnKeyUp

packages/core/test/buttons/buttonTests.tsx:171–190  ·  view source on GitHub ↗
(
            done: Mocha.Done,
            buttonProps: Partial<IButtonProps>,
            keyEventProps: Partial<React.KeyboardEvent<any>>,
        )

Source from the content-addressed store, hash-verified

169 }
170
171 function checkClickTriggeredOnKeyUp(
172 done: Mocha.Done,
173 buttonProps: Partial<IButtonProps>,
174 keyEventProps: Partial<React.KeyboardEvent<any>>,
175 ) {
176 const wrapper = button(buttonProps, true);
177
178 // mock the DOM click() function, because enzyme only handles
179 // simulated React events
180 const buttonRef = (wrapper.instance() as any).buttonRef;
181 const onClick = spy(buttonRef, "click");
182
183 wrapper.simulate("keyup", keyEventProps);
184
185 // wait for the whole lifecycle to run
186 setTimeout(() => {
187 assert.equal(onClick.callCount, 1);
188 done();
189 }, 0);
190 }
191
192 function checkKeyEventCallbackInvoked(callbackPropName: string, eventName: string, keyCode: number) {
193 const callback = spy();

Callers 1

buttonTestSuiteFunction · 0.85

Calls 3

buttonFunction · 0.85
spyFunction · 0.85
setTimeoutFunction · 0.50

Tested by

no test coverage detected