@vestra-player/sdk - v1.11.3
    Preparing search index...

    A command the plugin registered with plugin.commands.add, as the test host keeps it. Get one with TestHost.command (the plugin's own) or TestHost.coreAction (the player's core actions).

    The test checks the Loop item's menu place, picks it and sees its check mark turn on. host.command(id) is the host's record of what the plugin declared and the state it last sent; run() calls the plugin's run like the menu, after which the SDK re-evaluates the command's state and sends it, and run() resolves once the host is idle again.

    const toggle = host.command("toggle-loop");
    assert.deepEqual(toggle.declaration.path, ["Playback", "Loop"]);
    assert.equal(toggle.state.checked, false);
    await toggle.run();
    assert.equal(host.command("toggle-loop").state.checked, true);

    The host's record of one command: what the plugin declared, the state it last sent, and how the menu shows it in TestHost.locale. Read it again after settle() to see changes; run executes it as the menu would.

    1.0.0

    interface FakeCommand {
        declaration: CommandDeclaration;
        display: {
            title: string;
            path: string[];
            reason?: string | null;
            category?: string | null;
        };
        when?: { enabled?: Json; checked?: Json };
        state: {
            enabled: boolean;
            checked: boolean | null;
            busy: boolean;
            reason: TextValue | null;
        };
        revision: number;
        run(): Promise<void>;
    }
    Index
    • Execute the command the way the menu would, then wait until the host is idle. Rejects (with a HostError) when the command is disabled or busy, like the player, which does not call run then.

      Returns Promise<void>

      command (rejects) A HostError: the command is disabled or busy (the message says which).

      The test checks that Export cannot run while nothing is open. Like the player, the host does not call run for a disabled or busy command; the promise rejects with a HostError.

      await assert.rejects(host.command("export").run());
      

      1.0.0

    declaration: CommandDeclaration

    What the plugin declared: id, menu path, title, order, group, default bindings, focus and repeat. Wire-level shape; it may gain fields in minor versions.

    display: {
        title: string;
        path: string[];
        reason?: string | null;
        category?: string | null;
    }

    What the menu shows, as the player shows it in the test host's TestHost.locale: the title and each path segment translated with the plugin's catalog (the player's own menus in the player's words), the keys normalized (@video is "Video").

    Type Declaration

    • title: string

      The menu text of the item.

    • path: string[]

      Each segment of the path as shown; empty without a path.

    • Optionalreason?: string | null

      The disabled or busy reason as shown, null without one (a plugin command's; not enumerable, so comparing display with { title, path } still works).

      1.5.11

    • Optionalcategory?: string | null

      The category as shown (CommandOptions.category, translated with the plugin's catalog), null without one. Not enumerable, like reason.

      1.6.4

    1.5.9

    when?: { enabled?: Json; checked?: Json }

    The conditions the plugin sent for enabled and checked (plugin.when, wire form), undefined without. Like the player, the host evaluates them in FakeCommand.state against source, mainWindow.fullscreen, appearance and language.

    Type Declaration

    • Optionalenabled?: Json

      The condition of enabled.

    • Optionalchecked?: Json

      The condition of checked.

    1.5.40

    state: {
        enabled: boolean;
        checked: boolean | null;
        busy: boolean;
        reason: TextValue | null;
    }

    The command state as the player shows it: what the plugin last sent (after the update pass), with the fields given as conditions (plugin.when) evaluated now. With an enabled condition, reason is null while the command is enabled and not busy.

    Type Declaration

    • enabled: boolean

      false when the plugin disabled the command.

    • checked: boolean | null

      The check mark: true, false, or null for none.

    • busy: boolean

      true while the plugin reports the command as busy.

    • reason: TextValue | null

      The reason the plugin sent (source text or a text value; see display.reason).

    revision: number

    The state revision the player holds; increases with every state update the SDK sends.