import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action, set } from "@ember/object";

export default class TestController extends Controller {
    testButton = {
        label: "Button",
        className: "btn-info",
        tooltip: "This should do it",
        disabled: false,
    };

    @tracked formDef = {
        type: "form",
        action: "dummy",
        content: {
            title: "Test input",
            submit_label: "Perform",
            fields: [
                {
                    type: "select",
                    name: "test_select",
                    label: "Your choice:",
                    options: [
                        { value: 1, label: "Major" },
                        { value: 2, label: "Tom" },
                    ],
                },
                {
                    type: "password",
                    name: "pwd",
                    label: "Password",
                },
                {
                    type: "passwordverify",
                    name: "pwd_verified",
                    label: "Verified password",
                },
            ],
            buttons: [
                {
                    label: "Link to external",
                    className: "btn-info",
                    tooltip: "Just fyi",
                    href: "https://www.openxpki.org",
                    target: "_blank",
                },
                this.testButton,
                {
                    ...this.testButton,
                    label: "With confirmation",
                    confirm: {
                        label: "Really sure?",
                        description: "Think about it one more time.",
                    },
                },
                {
                    ...this.testButton,
                    label: "Disabled",
                    disabled: true,
                },
            ],
        }
    };
}

@@ -841,32 +841,337 @@
               %7B%0A
+                    type: %22select%22,%0A                    name: %22test_select_2%22,%0A                    label: %22Only one choice%22,%0A                    options: %5B%0A                        %7B value: %22%22, label: %22The Void%22 %7D,%0A                    %5D,%0A                    value: %22%22,%0A                %7D,%0A                %7B%0A
                 

add test for single-value selection list