tests.screen
Queries over what the last render shows.
Utilização
Query the rendered screen.
// Query the rendered screen.
import { Button, Text, VStack } from 'kuito';
import { assert, render, screen, test } from 'kuito/tests';
const Empty = () => (
<VStack>
<Text>No messages yet</Text>
<Button>Write one</Button>
</VStack>
);
test('an empty inbox invites a first message', async () => {
await render(<Empty />);
assert.ok(screen.getByText('No messages yet'));
assert.ok(screen.getByRole('button', { name: 'Write one' }));
assert.equal(screen.queryByText('Inbox'), null);
});Propriedades e métodos 6
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
getByText | (text: TextMatch) => TestView | Sim | The one view showing text; throws when none or several do. |
getAllByText | (text: TextMatch) => TestView[] | Sim | — |
queryByText | (text: TextMatch) => TestView | null | Sim | — |
getByRole | (role: string, options?: RoleOptions) => TestView | Sim | The one view with role (and name, when given); throws when none or several have it. |
getAllByRole | (role: string, options?: RoleOptions) => TestView[] | Sim | — |
queryByRole | (role: string, options?: RoleOptions) => TestView | null | Sim | — |
getByText — assinaturas de método
Assinaturas
(text: TextMatch): TestViewParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
text | TextMatch | Sim | — |
Devolve
TestView
getAllByText — assinaturas de método
Assinaturas
(text: TextMatch): TestView[]Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
text | TextMatch | Sim | — |
Devolve
TestView[]
queryByText — assinaturas de método
Assinaturas
(text: TextMatch): TestView | nullParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
text | TextMatch | Sim | — |
Devolve
TestView
getByRole — assinaturas de método
Assinaturas
(role: string, options?: RoleOptions): TestViewParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
role | string | Sim | — |
options | RoleOptions | Não | — |
Devolve
TestView
getAllByRole — assinaturas de método
Assinaturas
(role: string, options?: RoleOptions): TestView[]Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
role | string | Sim | — |
options | RoleOptions | Não | — |
Devolve
TestView[]
queryByRole — assinaturas de método
Assinaturas
(role: string, options?: RoleOptions): TestView | nullParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
role | string | Sim | — |
options | RoleOptions | Não | — |
Devolve
TestView
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.