fix: explain missing funding search criteria instead of disabling submit
This commit is contained in:
@@ -333,7 +333,7 @@ void test('contradictory record criteria remain explicit until the user chooses
|
||||
);
|
||||
});
|
||||
|
||||
void test('search needs both location and purpose; Enter and missing criteria cannot submit', () => {
|
||||
void test('search explains missing location/purpose on click or Enter and never sends an invalid search', () => {
|
||||
for (const filters of [
|
||||
{},
|
||||
{ need: 'investment' },
|
||||
@@ -343,15 +343,21 @@ void test('search needs both location and purpose; Enter and missing criteria ca
|
||||
const submit = nodes(h.tree()).find(
|
||||
(n) => n.type === 'button' && text(n) === 'Pesquisar',
|
||||
);
|
||||
assert.equal(submit.props.disabled, true);
|
||||
assert.equal(submit.props.disabled, false);
|
||||
nodes(h.tree())
|
||||
.find((n) => n.type === 'form')
|
||||
.props.onSubmit({ preventDefault() {} });
|
||||
assert.equal(h.submitted(), undefined);
|
||||
assert.match(
|
||||
text(h.tree()),
|
||||
/Escolha a localização a pesquisar e a necessidade/,
|
||||
);
|
||||
h.render();
|
||||
assert.ok(nodes(h.tree()).some((n) => n.props?.role === 'alert'));
|
||||
if (!filters.need)
|
||||
assert.match(
|
||||
text(h.tree()),
|
||||
/Seleccione a necessidade do processo/,
|
||||
);
|
||||
if (!filters.province_id)
|
||||
assert.match(text(h.tree()), /Seleccione a província/);
|
||||
assert.match(text(h.tree()), /A pesquisa não foi executada/);
|
||||
}
|
||||
for (const location of [
|
||||
{ province_id: 'province-qa' },
|
||||
|
||||
Reference in New Issue
Block a user