-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Naszalyi
committed
Nov 10, 2024
1 parent
fa077e7
commit f86508c
Showing
22 changed files
with
35 additions
and
371 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
6 changes: 3 additions & 3 deletions
6
packages/react/components/chips/list/test/ChipsList.native.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { render, screen } from '@testing-library/react-native' | ||
import * as React from 'react' | ||
import Chips from '../../Chips.native' | ||
import ChipsList from '../ChipsList' | ||
import ChipsList from '../ChipsList.native' | ||
|
||
describe('chips component', () => { | ||
it('renders the children correctly', () => { | ||
render( | ||
<ChipsList data-testid='chips-list' multiple> | ||
<ChipsList multiple> | ||
<Chips>Hello, world!</Chips> | ||
</ChipsList>, | ||
) | ||
expect(screen.getByTestId('Hello, world!')).toBeOnTheScreen() | ||
expect(screen.getByText('Hello, world!')).toBeOnTheScreen() | ||
}) | ||
}) |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,44 +1,12 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react-native' | ||
import { render, screen } from '@testing-library/react-native' | ||
import * as React from 'react' | ||
import Otp from '../Otp' | ||
|
||
jest.useFakeTimers() | ||
|
||
describe('Otp', () => { | ||
it('renders', () => { | ||
const onChange = jest.fn() | ||
const onCompleted = jest.fn() | ||
render(<Otp onChange={onChange} code='123456' onCompleted={onCompleted} label='label' />) | ||
Array.from({ length: 6 }).map((_, i) => { | ||
expect(screen.getByText(String(i + 1))) | ||
}) | ||
|
||
const input = screen.getByTestId('input-id') | ||
expect(input.props.value).toEqual('123456') | ||
fireEvent.changeText(input, '123') | ||
|
||
Array.from({ length: 3 }).map((_, i) => { | ||
expect(screen.queryByText(String(i + 4))).toBeNull() | ||
}) | ||
|
||
fireEvent.changeText(input, '123456') | ||
expect(onCompleted).toHaveBeenCalled() | ||
expect(onChange).toHaveBeenCalled() | ||
expect(screen.getByText('label')) | ||
}) | ||
|
||
it('disabled', () => { | ||
render(<Otp disabled code='123456' />) | ||
Array.from({ length: 6 }).map((_, i) => { | ||
expect(screen.getByText(String(i + 1))) | ||
}) | ||
|
||
const input = screen.getByTestId('input-id') | ||
expect(input.props.value).toEqual('123456') | ||
fireEvent.changeText(input, '123') | ||
|
||
Array.from({ length: 3 }).map((_, i) => { | ||
expect(screen.getByText(String(i + 4))) | ||
}) | ||
render(<Otp label='label' />) | ||
expect(screen.getByText('label')).toBeOnTheScreen() | ||
}) | ||
}) |
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
18 changes: 2 additions & 16 deletions
18
packages/react/components/price/test/Price.native.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 |
---|---|---|
@@ -1,24 +1,10 @@ | ||
import { getDefaultNormalizer, render, screen } from '@testing-library/react-native' | ||
import { render, screen } from '@testing-library/react-native' | ||
import * as React from 'react' | ||
import Price from '../Price' | ||
|
||
describe('Price', () => { | ||
it('renders correctly with whole amount', () => { | ||
render(<Price testId='price' level={1} amount={24.99} showCents period={'mois'} tagAmount={10} tagSymbol={'€'} />) | ||
render(<Price level={1} amount={24} period={'mois'} tagAmount={10} tagSymbol={'€'} />) | ||
expect(screen.getByText('24')).toBeOnTheScreen() | ||
expect(screen.getByText('€99')).toBeOnTheScreen() | ||
expect(screen.getByText('10 €')).toBeOnTheScreen() | ||
expect( | ||
screen.queryByText('/mois', { | ||
normalizer: getDefaultNormalizer({ trim: false }), | ||
}), | ||
).toBeOnTheScreen() | ||
}) | ||
|
||
it('renders correctly with suptitle', () => { | ||
render(<Price amount={20} overline='Starting at' showCents={false} />) | ||
expect(screen.getByText('Starting at')).toBeOnTheScreen() | ||
expect(screen.getByText('20')).toBeOnTheScreen() | ||
expect(screen.getByText('€')).toBeOnTheScreen() | ||
}) | ||
}) |
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
Oops, something went wrong.