Merge branch 'review/off-queue-portraits'
This commit is contained in:
@@ -178,4 +178,42 @@ describe('swarmUiSettingsDialog', () => {
|
||||
expect(values).not.toContain('other.safetensors');
|
||||
void opened;
|
||||
});
|
||||
|
||||
it('shows the selected model generation defaults after a model change', async () => {
|
||||
vi.mocked(fetchSwarmUiDiscovery).mockResolvedValue(
|
||||
discovery({ models: ['template.safetensors', 'other.safetensors'] }),
|
||||
);
|
||||
const opened = swarmUiSettingsDialog(settings());
|
||||
const dialog = await vi.waitFor(() => {
|
||||
const node = document.querySelector('dialog');
|
||||
const label = node === null
|
||||
? undefined
|
||||
: [...node.querySelectorAll('.field__label')].find((entry) => entry.textContent === t('settingsModel'));
|
||||
if (node === null || label === undefined) {
|
||||
throw new Error('model field is not painted');
|
||||
}
|
||||
|
||||
return node;
|
||||
});
|
||||
|
||||
const label = [...dialog.querySelectorAll('.field__label')].find((node) => node.textContent === t('settingsModel'));
|
||||
const select = label?.parentElement?.querySelector('select');
|
||||
if (!(select instanceof HTMLSelectElement)) {
|
||||
throw new Error('model select is missing');
|
||||
}
|
||||
|
||||
select.value = 'other.safetensors';
|
||||
select.dispatchEvent(new Event('change'));
|
||||
|
||||
const stepsLabel = [...dialog.querySelectorAll('.settings-model .field__label')].find(
|
||||
(node) => node.textContent === t('settingsSteps'),
|
||||
);
|
||||
const stepsInput = stepsLabel?.parentElement?.querySelector('input');
|
||||
if (!(stepsInput instanceof HTMLInputElement)) {
|
||||
throw new Error('model steps field is missing');
|
||||
}
|
||||
|
||||
expect(stepsInput.value).toBe('8');
|
||||
void opened;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user