Utilisation

Observe system display settings.

Ce type est utilisé par tests.render

tsx
// Observe system display settings.
import { appearance } from 'kuito';
import { render, test } from 'kuito/tests';

const dark: appearance.AppearancePreferences = { colorScheme: 'dark', fontScale: 1.3 };

test('the header reads in dark mode at a large text size', async () => {
  await render(<Header />, { modules: { Appearance: dark } });
});

function Header() {
  return null;
}

Déclaration du type

ts
export interface RenderedApp extends Queries {
  /** Every view, one line each in id order, as a device describes its tree. */
  tree(): string;
  /** The mutations the kernel's batches carried since this render, in order. */
  readonly mutations: readonly Mutation[];
  /** The native module calls the app made, in order. */
  readonly calls: readonly ModuleCall[];
  /** What the app and the runtime logged. */
  readonly logs: readonly LogEntry[];
  /** Sends a native module's event or live value change, as the platform does. */
  emit(module: string, name: string, value?: unknown): Promise<void>;
}

Membres 11

NomTypeRequisDescription
tree() => stringOuiEvery view, one line each in id order, as a device describes its tree.
mutationslecture seulereadonly Mutation[]OuiThe mutations the kernel's batches carried since this render, in order.
callslecture seulereadonly ModuleCall[]OuiThe native module calls the app made, in order.
logslecture seulereadonly LogEntry[]OuiWhat the app and the runtime logged.
emit(module: string, name: string, value?: unknown) => Promise<void>OuiSends a native module's event or live value change, as the platform does.
getByText(text: TextMatch) => TestViewOuiThe one view showing text; throws when none or several do.
getAllByText(text: TextMatch) => TestView[]Oui—
queryByText(text: TextMatch) => TestView | nullOui—
getByRole(role: string, options?: RoleOptions) => TestViewOuiThe one view with role (and name, when given); throws when none or several have it.
getAllByRole(role: string, options?: RoleOptions) => TestView[]Oui—
queryByRole(role: string, options?: RoleOptions) => TestView | nullOui—
tree — signatures de méthode

Signatures

ts
(): string

Paramètres

Aucun paramètre.

Retourne

string

emit — signatures de méthode

Signatures

ts
(module: string, name: string, value?: unknown): Promise<void>

Paramètres

NomTypeRequisDescription
modulestringOui—
namestringOui—
valueunknownNon—

Retourne

Promise<void>

getByText — signatures de méthode

Signatures

ts
(text: TextMatch): TestView

Paramètres

NomTypeRequisDescription
textTextMatchOui—

Retourne

TestView

getAllByText — signatures de méthode

Signatures

ts
(text: TextMatch): TestView[]

Paramètres

NomTypeRequisDescription
textTextMatchOui—

Retourne

TestView[]

queryByText — signatures de méthode

Signatures

ts
(text: TextMatch): TestView | null

Paramètres

NomTypeRequisDescription
textTextMatchOui—

Retourne

TestView

getByRole — signatures de méthode

Signatures

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

Paramètres

NomTypeRequisDescription
rolestringOui—
optionsRoleOptionsNon—

Retourne

TestView

getAllByRole — signatures de méthode

Signatures

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

Paramètres

NomTypeRequisDescription
rolestringOui—
optionsRoleOptionsNon—

Retourne

TestView[]

queryByRole — signatures de méthode

Signatures

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

Paramètres

NomTypeRequisDescription
rolestringOui—
optionsRoleOptionsNon—

Retourne

TestView

Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.