From 8c07320b7e22e3cc8f9de736556d768f4b2c05e4 Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Fri, 8 May 2020 14:28:48 -0500 Subject: [PATCH] fix(test): meet coverage thresholds after refactoring --- src/components/Header/Header.test.jsx | 1 + .../Header/HeaderAction/HeaderAction.jsx | 3 --- .../TimePickerSpinner/TimePickerSpinner.test.jsx | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/Header/Header.test.jsx b/src/components/Header/Header.test.jsx index 036caf4e40..6abaf28931 100644 --- a/src/components/Header/Header.test.jsx +++ b/src/components/Header/Header.test.jsx @@ -51,6 +51,7 @@ describe('Header testcases', () => { { label: 'user', btnContent: , + menuLinkName: 'a menu link name', childContent: [ { metaData: { diff --git a/src/components/Header/HeaderAction/HeaderAction.jsx b/src/components/Header/HeaderAction/HeaderAction.jsx index 563e0cea38..b2435774b2 100644 --- a/src/components/Header/HeaderAction/HeaderAction.jsx +++ b/src/components/Header/HeaderAction/HeaderAction.jsx @@ -123,8 +123,5 @@ const HeaderAction = ({ item, index }) => { }; HeaderAction.propTypes = HeaderActionPropTypes; -HeaderAction.defaultProps = { - item: { onClick: () => {} }, -}; export default HeaderAction; diff --git a/src/components/TimePickerSpinner/TimePickerSpinner.test.jsx b/src/components/TimePickerSpinner/TimePickerSpinner.test.jsx index 11f253118a..07844e444e 100644 --- a/src/components/TimePickerSpinner/TimePickerSpinner.test.jsx +++ b/src/components/TimePickerSpinner/TimePickerSpinner.test.jsx @@ -69,6 +69,19 @@ describe('TimePickerSpinner', () => { expect(screen.getByRole('textbox').value).toEqual('00:00'); }); + test('value is not modified on unrelated keystroke', () => { + render(); + + screen.getByRole('textbox').focus(); + + fireEvent.keyUp(document.activeElement || document.body, { + key: 'Escape', + code: 'Escape', + keyCode: keyCodes.ESCAPE, + }); + expect(screen.getByRole('textbox').value).toEqual(''); + }); + test('work with strings', () => { const wrapper = mount(); @@ -104,6 +117,7 @@ describe('TimePickerSpinner', () => { upButton.simulate('mouseover'); upButton.simulate('mouseout'); upButton.simulate('blur'); + upButton.simulate('mouseout'); expect( wrapper .find('.iot--time-picker__wrapper')