forked from alibaba/ChatUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: update LocaleProvider * test: update Time * test: update Modal * test: update Toolbar * test: update Toast * test: add snapshots * test: update Stepper * test: remove SendConfirm & Tree test files * test: update Goods * test: update Form * test: update Input * test: add useMessages test * test: add useQuickReplies test * docs: update README
- Loading branch information
Showing
33 changed files
with
1,378 additions
and
285 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { render, cleanup } from '@testing-library/react'; | ||
import { FormActions } from '..'; | ||
|
||
afterEach(cleanup); | ||
|
||
describe('<FormActions />', () => { | ||
it('should render a form actions', () => { | ||
const { getByTestId } = render(<FormActions data-testid="formActions" />); | ||
const formActions = getByTestId('formActions'); | ||
|
||
expect(formActions).toHaveClass('FormActions'); | ||
}); | ||
|
||
it('should render children', () => { | ||
const { getByTestId } = render( | ||
<FormActions data-testid="formActions"> | ||
<span>testChild</span> | ||
</FormActions>, | ||
); | ||
const formActions = getByTestId('formActions'); | ||
|
||
expect(formActions).toContainHTML('<span>testChild</span>'); | ||
}); | ||
}); |
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,21 @@ | ||
import React from 'react'; | ||
import { render, cleanup } from '@testing-library/react'; | ||
import { Form } from '..'; | ||
|
||
afterEach(cleanup); | ||
|
||
describe('<Form />', () => { | ||
it('should render a form', () => { | ||
const { getByTestId } = render(<Form data-testid="form" />); | ||
const form = getByTestId('form'); | ||
|
||
expect(form).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render a form (light)', () => { | ||
const { getByTestId } = render(<Form theme="light" data-testid="form" />); | ||
const form = getByTestId('form'); | ||
|
||
expect(form).toHaveClass('is-light'); | ||
}); | ||
}); |
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,44 @@ | ||
import React from 'react'; | ||
import { render, cleanup } from '@testing-library/react'; | ||
import { FormItem } from '..'; | ||
|
||
afterEach(cleanup); | ||
|
||
describe('<FormItem />', () => { | ||
it('should render a label', () => { | ||
const { container } = render(<FormItem label="testLabel" />); | ||
const formItem = container.querySelector('.FormItem'); | ||
|
||
expect(formItem?.querySelector('.Label')).not.toBeNull(); | ||
expect(formItem).toHaveTextContent('testLabel'); | ||
}); | ||
|
||
it('should render a help text', () => { | ||
const { container } = render(<FormItem help="testHelp" />); | ||
const formItem = container.querySelector('.FormItem'); | ||
|
||
expect(formItem?.querySelector('.HelpText')).not.toBeNull(); | ||
expect(formItem).toHaveTextContent('testHelp'); | ||
}); | ||
|
||
it('should have a status (required)', () => { | ||
const { container } = render(<FormItem required />); | ||
const formItem = container.querySelector('.FormItem'); | ||
|
||
expect(formItem).toHaveClass('required'); | ||
}); | ||
|
||
it('should have a status (invalid)', () => { | ||
const { container } = render(<FormItem invalid />); | ||
const formItem = container.querySelector('.FormItem'); | ||
|
||
expect(formItem).toHaveClass('is-invalid'); | ||
}); | ||
|
||
it('should be hidden if specified', () => { | ||
const { container } = render(<FormItem hidden />); | ||
const formItem = container.querySelector('.FormItem'); | ||
|
||
expect(formItem).toHaveAttribute('hidden'); | ||
}); | ||
}); |
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.