chore: make text input field of kubernetes filepath in preferences page editable (#8139)

chore: make text input field of kubernetes filepath in preferences page editable

Signed-off-by: Sonia Sandler <ssandler@redhat.com>
This commit is contained in:
SoniaSandler 2024-07-18 09:58:22 -04:00 committed by GitHub
parent 12077341a3
commit 5a3f29c8b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View file

@ -197,6 +197,7 @@ export class KubernetesClient {
type: 'string',
default: defaultKubeconfigPath,
format: 'file',
readonly: false,
},
},
};

View file

@ -160,10 +160,28 @@ test('Expect a fileinput when record is type string and format file', async () =
expect(readOnlyInput).toBeInTheDocument();
expect(readOnlyInput instanceof HTMLInputElement).toBe(true);
expect((readOnlyInput as HTMLInputElement).placeholder).toBe(record.placeholder);
expect((readOnlyInput as HTMLInputElement).readOnly).toBeTruthy();
const input = screen.getByLabelText('browse');
expect(input).toBeInTheDocument();
});
test('Expect an editable text fileinput when record is type string and format file', async () => {
const record: IConfigurationPropertyRecordedSchema = {
title: 'record',
parentId: 'parent.record',
placeholder: 'Example: text',
description: 'record-description',
type: 'string',
format: 'file',
readonly: false,
};
await awaitRender(record, {});
const writeInput = screen.getByLabelText('record-description');
expect(writeInput).toBeInTheDocument();
expect(writeInput instanceof HTMLInputElement).toBe(true);
expect((writeInput as HTMLInputElement).readOnly).toBeFalsy();
});
test('Expect a fileinput when record is type string and format folder', async () => {
const record: IConfigurationPropertyRecordedSchema = {
title: 'record',

View file

@ -30,7 +30,7 @@ $: if (value !== lastValue) {
id="input-standard-{record.id}"
name={record.id}
bind:value={value}
readonly
readonly={record.readonly ?? true}
placeholder={record.placeholder}
options={dialogOptions}
aria-invalid={invalidEntry}