tests.RenderedApp
The app a render put on the headless screen.
Usage
Observe system display settings.
This type is used by tests.render
// 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;
}Type declaration
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>;
}Members 11
| Name | Type | Required | Description |
|---|---|---|---|
tree | () => string | Yes | Every view, one line each in id order, as a device describes its tree. |
mutationsreadonly | readonly Mutation[] | Yes | The mutations the kernel's batches carried since this render, in order. |
callsreadonly | readonly ModuleCall[] | Yes | The native module calls the app made, in order. |
logsreadonly | readonly LogEntry[] | Yes | What the app and the runtime logged. |
emit | (module: string, name: string, value?: unknown) => Promise<void> | Yes | Sends a native module's event or live value change, as the platform does. |
getByText | (text: TextMatch) => TestView | Yes | The one view showing text; throws when none or several do. |
getAllByText | (text: TextMatch) => TestView[] | Yes | — |
queryByText | (text: TextMatch) => TestView | null | Yes | — |
getByRole | (role: string, options?: RoleOptions) => TestView | Yes | The one view with role (and name, when given); throws when none or several have it. |
getAllByRole | (role: string, options?: RoleOptions) => TestView[] | Yes | — |
queryByRole | (role: string, options?: RoleOptions) => TestView | null | Yes | — |
tree — method signatures
Signatures
(): stringParameters
No parameters.
Returns
string
emit — method signatures
Signatures
(module: string, name: string, value?: unknown): Promise<void>Parameters
| Name | Type | Required | Description |
|---|---|---|---|
module | string | Yes | — |
name | string | Yes | — |
value | unknown | No | — |
Returns
Promise<void>
getByText — method signatures
Signatures
(text: TextMatch): TestViewParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | TextMatch | Yes | — |
Returns
TestView
getAllByText — method signatures
Signatures
(text: TextMatch): TestView[]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text | TextMatch | Yes | — |
Returns
TestView[]
queryByText — method signatures
Signatures
(text: TextMatch): TestView | nullParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | TextMatch | Yes | — |
Returns
TestView
getByRole — method signatures
Signatures
(role: string, options?: RoleOptions): TestViewParameters
| Name | Type | Required | Description |
|---|---|---|---|
role | string | Yes | — |
options | RoleOptions | No | — |
Returns
TestView
getAllByRole — method signatures
Signatures
(role: string, options?: RoleOptions): TestView[]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
role | string | Yes | — |
options | RoleOptions | No | — |
Returns
TestView[]
queryByRole — method signatures
Signatures
(role: string, options?: RoleOptions): TestView | nullParameters
| Name | Type | Required | Description |
|---|---|---|---|
role | string | Yes | — |
options | RoleOptions | No | — |
Returns
TestView
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.