Utilização

Query the rendered screen.

tsx
// 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

NomeTipoObrigatórioDescrição
getByText(text: TextMatch) => TestViewSimThe one view showing text; throws when none or several do.
getAllByText(text: TextMatch) => TestView[]Sim—
queryByText(text: TextMatch) => TestView | nullSim—
getByRole(role: string, options?: RoleOptions) => TestViewSimThe 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 | nullSim—
getByText — assinaturas de método

Assinaturas

ts
(text: TextMatch): TestView

Parâmetros

NomeTipoObrigatórioDescrição
textTextMatchSim—

Devolve

TestView

getAllByText — assinaturas de método

Assinaturas

ts
(text: TextMatch): TestView[]

Parâmetros

NomeTipoObrigatórioDescrição
textTextMatchSim—

Devolve

TestView[]

queryByText — assinaturas de método

Assinaturas

ts
(text: TextMatch): TestView | null

Parâmetros

NomeTipoObrigatórioDescrição
textTextMatchSim—

Devolve

TestView

getByRole — assinaturas de método

Assinaturas

ts
(role: string, options?: RoleOptions): TestView

Parâmetros

NomeTipoObrigatórioDescrição
rolestringSim—
optionsRoleOptionsNão—

Devolve

TestView

getAllByRole — assinaturas de método

Assinaturas

ts
(role: string, options?: RoleOptions): TestView[]

Parâmetros

NomeTipoObrigatórioDescrição
rolestringSim—
optionsRoleOptionsNão—

Devolve

TestView[]

queryByRole — assinaturas de método

Assinaturas

ts
(role: string, options?: RoleOptions): TestView | null

Parâmetros

NomeTipoObrigatórioDescrição
rolestringSim—
optionsRoleOptionsNã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.