-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from kubit-ui/feature/improvements-and-bugs-so…
…lved Feature/improvements and bugs solved
- Loading branch information
Showing
48 changed files
with
1,155 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
export type StepperNumberprefixSuffixType = { | ||
prefix?: { | ||
step: string; | ||
of: string; | ||
}; | ||
suffix?: { | ||
completed: string; | ||
current: string; | ||
}; | ||
prefix?: { step: string; of: string; steps?: string; completed?: string }; | ||
suffix?: { completed: string; current: string }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/components/virtualKeyboard/__tests__/virtualKeyboard.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { fireEvent, screen } from '@testing-library/react'; | ||
import * as React from 'react'; | ||
|
||
import { axe } from 'jest-axe'; | ||
|
||
import { renderProvider } from '@/tests/renderProvider/renderProvider.utility'; | ||
import { ROLES } from '@/types'; | ||
|
||
import { VirtualKeyboard } from '../index'; | ||
import { IVirtualKeyboard } from '../types'; | ||
|
||
const mockProps: IVirtualKeyboard = { | ||
variant: 'DEFAULT', | ||
digits: ['0', '4', '2', '8', '7', '3', '9', '1', '6', '5'], | ||
icon: { icon: 'CLOSE', altText: 'Remove' }, | ||
dataTestId: 'test-data', | ||
onDigitButtonClick: jest.fn(), | ||
onRemoveButtonClick: jest.fn(), | ||
}; | ||
|
||
describe('Virtual Keyboard component', () => { | ||
it('Should render component', async () => { | ||
const { container } = renderProvider(<VirtualKeyboard {...mockProps} />); | ||
|
||
const buttons = screen.getAllByRole(ROLES.BUTTON); | ||
expect(buttons).toHaveLength(11); | ||
|
||
const results = await axe(container); | ||
expect(container).toHTMLValidate(); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
|
||
it('Should callback onDigitButtonClick and onRemoveButtonClick when pressed', () => { | ||
const onDigitButtonClick = jest.fn(); | ||
const onRemoveButtonClick = jest.fn(); | ||
renderProvider( | ||
<VirtualKeyboard | ||
{...mockProps} | ||
onDigitButtonClick={onDigitButtonClick} | ||
onRemoveButtonClick={onRemoveButtonClick} | ||
/> | ||
); | ||
|
||
const buttons = screen.getAllByRole(ROLES.BUTTON); | ||
fireEvent.click(buttons[0]); | ||
expect(onDigitButtonClick).toHaveBeenCalled(); | ||
|
||
fireEvent.click(buttons[10]); | ||
expect(onRemoveButtonClick).toHaveBeenCalled(); | ||
}); | ||
|
||
it('When onFocus and onBlur will change internal styles, but no action will be called', () => { | ||
const onDigitButtonClick = jest.fn(); | ||
const onRemoveButtonClick = jest.fn(); | ||
renderProvider( | ||
<VirtualKeyboard | ||
{...mockProps} | ||
onDigitButtonClick={onDigitButtonClick} | ||
onRemoveButtonClick={onRemoveButtonClick} | ||
/> | ||
); | ||
|
||
const buttons = screen.getAllByRole(ROLES.BUTTON); | ||
fireEvent.focus(buttons[0]); | ||
fireEvent.blur(buttons[0]); | ||
expect(mockProps.onDigitButtonClick).not.toHaveBeenCalled(); | ||
}); | ||
}); |
Oops, something went wrong.