"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const form_js_1 = require("./form.js");
(0, vitest_1.describe)('getDisplayOnlyFieldNames', () => {
    (0, vitest_1.it)('returns ALERT field names', () => {
        const template = {
            sections: [
                {
                    name: 'auth',
                    items: [
                        {
                            name: 'HTTPBasicAlert',
                            label: '',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.ALERT,
                            messageTemplate: 'some info'
                        }
                    ]
                }
            ]
        };
        (0, vitest_1.expect)((0, form_js_1.getDisplayOnlyFieldNames)(template)).toEqual(new Set(['HTTPBasicAlert']));
    });
    (0, vitest_1.it)('returns BUTTON field names', () => {
        const template = {
            sections: [
                {
                    name: 'authButtons',
                    items: [
                        {
                            rowItems: [
                                {
                                    name: 'oauth-connect-button',
                                    label: 'Connect',
                                    startVersion: '1',
                                    componentType: form_js_1.FormComponentType.BUTTON,
                                    buttonType: 'connectOAuth'
                                },
                                {
                                    name: 'oauth-revoke-shared-tokens-button',
                                    label: 'Revoke',
                                    startVersion: '1',
                                    componentType: form_js_1.FormComponentType.BUTTON,
                                    buttonType: 'revokeOAuthTokens'
                                }
                            ]
                        }
                    ]
                }
            ]
        };
        (0, vitest_1.expect)((0, form_js_1.getDisplayOnlyFieldNames)(template)).toEqual(new Set(['oauth-connect-button', 'oauth-revoke-shared-tokens-button']));
    });
    (0, vitest_1.it)('returns disabled + immutable INPUT_TEXT field names', () => {
        const template = {
            sections: [
                {
                    name: 'auth',
                    items: [
                        {
                            name: 'oauth-callback-alert',
                            label: 'Callback URL',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.INPUT_TEXT,
                            disabled: true,
                            immutable: true,
                            initialValue: 'https://example.com/oauth/callback'
                        }
                    ]
                }
            ]
        };
        (0, vitest_1.expect)((0, form_js_1.getDisplayOnlyFieldNames)(template)).toEqual(new Set(['oauth-callback-alert']));
    });
    (0, vitest_1.it)('does not include regular INPUT_TEXT fields', () => {
        const template = {
            sections: [
                {
                    name: 'main',
                    items: [
                        {
                            name: 'path',
                            label: 'URL',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.INPUT_TEXT
                        }
                    ]
                }
            ]
        };
        (0, vitest_1.expect)((0, form_js_1.getDisplayOnlyFieldNames)(template).size).toBe(0);
    });
    (0, vitest_1.it)('does not include disabled-only fields without immutable', () => {
        const template = {
            sections: [
                {
                    name: 'main',
                    items: [
                        {
                            name: 'path',
                            label: 'URL',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.INPUT_TEXT,
                            disabled: true
                        }
                    ]
                }
            ]
        };
        (0, vitest_1.expect)((0, form_js_1.getDisplayOnlyFieldNames)(template).size).toBe(0);
    });
    (0, vitest_1.it)('handles mixed sections with normal and display-only fields', () => {
        const template = {
            sections: [
                {
                    name: 'main',
                    items: [
                        {
                            name: 'path',
                            label: 'URL',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.INPUT_TEXT
                        },
                        {
                            name: 'OAuth2PasswordAlert',
                            label: '',
                            startVersion: '1',
                            componentType: form_js_1.FormComponentType.ALERT
                        }
                    ]
                },
                {
                    name: 'authButtons',
                    items: [
                        {
                            rowItems: [
                                {
                                    name: 'oauth-connect-button',
                                    label: 'Connect',
                                    startVersion: '1',
                                    componentType: form_js_1.FormComponentType.BUTTON,
                                    buttonType: 'connectOAuth'
                                }
                            ]
                        }
                    ]
                }
            ]
        };
        const result = (0, form_js_1.getDisplayOnlyFieldNames)(template);
        (0, vitest_1.expect)(result).toEqual(new Set(['OAuth2PasswordAlert', 'oauth-connect-button']));
        (0, vitest_1.expect)(result.has('path')).toBe(false);
    });
});
//# sourceMappingURL=form.test.js.map