Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6c1b60612 |
@@ -54,9 +54,26 @@
|
|||||||
.catalogue-filters-heading {
|
.catalogue-filters-heading {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#catalogue-filter-fields {
|
#catalogue-filter-fields,
|
||||||
|
.catalogue-service-fields {
|
||||||
padding: 0 1.15rem 1.15rem;
|
padding: 0 1.15rem 1.15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.catalogue-service-fields label {
|
||||||
|
min-width: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.catalogue-service-fields label input:not([type='checkbox']),
|
||||||
|
.catalogue-service-fields label select {
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
.catalogue-service-fields .catalogue-filter-submit > button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
.catalogue-filters input:not([type='checkbox']),
|
.catalogue-filters input:not([type='checkbox']),
|
||||||
.catalogue-filters select {
|
.catalogue-filters select {
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,133 @@
|
|||||||
|
import test from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import { compileFunction } from 'node:vm';
|
||||||
|
import { createRequire } from 'node:module';
|
||||||
|
import { createElement } from 'react';
|
||||||
|
import { renderToStaticMarkup } from 'react-dom/server';
|
||||||
|
import ts from 'typescript';
|
||||||
|
|
||||||
|
const require = createRequire(import.meta.url);
|
||||||
|
const Empty = () => null;
|
||||||
|
function render(section, filters = {}) {
|
||||||
|
const source = fs.readFileSync(
|
||||||
|
new URL(
|
||||||
|
'../../resources/js/pages/portal/services.tsx',
|
||||||
|
import.meta.url,
|
||||||
|
),
|
||||||
|
'utf8',
|
||||||
|
);
|
||||||
|
const code = ts.transpileModule(source, {
|
||||||
|
compilerOptions: {
|
||||||
|
module: ts.ModuleKind.CommonJS,
|
||||||
|
target: ts.ScriptTarget.ES2022,
|
||||||
|
jsx: ts.JsxEmit.ReactJSX,
|
||||||
|
},
|
||||||
|
}).outputText;
|
||||||
|
const module = { exports: {} };
|
||||||
|
const props = { auth: { user: null } };
|
||||||
|
const mocks = {
|
||||||
|
'lucide-react': {
|
||||||
|
ChevronDown: Empty,
|
||||||
|
Search: Empty,
|
||||||
|
SlidersHorizontal: Empty,
|
||||||
|
},
|
||||||
|
'@inertiajs/react': {
|
||||||
|
Head: Empty,
|
||||||
|
Link: 'a',
|
||||||
|
usePage: () => ({ props, url: '/documentos' }),
|
||||||
|
useForm: (data) => ({ data, setData() {}, get() {} }),
|
||||||
|
},
|
||||||
|
'@/lib/document-facet-label': { documentFacetLabel: (value) => value },
|
||||||
|
'@/lib/portal-presentation': { PORTAL_MORE_LINK: '' },
|
||||||
|
'../../../css/investment-catalogue.css': {},
|
||||||
|
};
|
||||||
|
compileFunction(code, ['require', 'module', 'exports'])(
|
||||||
|
(name) => {
|
||||||
|
if (mocks[name]) return mocks[name];
|
||||||
|
if (name.startsWith('@/'))
|
||||||
|
return new Proxy(
|
||||||
|
{ __esModule: true, default: Empty },
|
||||||
|
{ get: (target, key) => target[key] ?? Empty },
|
||||||
|
);
|
||||||
|
return require(name);
|
||||||
|
},
|
||||||
|
module,
|
||||||
|
module.exports,
|
||||||
|
);
|
||||||
|
return renderToStaticMarkup(
|
||||||
|
createElement(module.exports.default, {
|
||||||
|
section,
|
||||||
|
filters,
|
||||||
|
topics: ['Fiscalidade'],
|
||||||
|
categories: ['Legislação'],
|
||||||
|
documentTypes: ['guide'],
|
||||||
|
activities: ['CAE exemplo'],
|
||||||
|
stages: ['Etapa exemplo'],
|
||||||
|
modules: ['simulator'],
|
||||||
|
issuers: ['Instituição exemplo'],
|
||||||
|
languages: ['Português'],
|
||||||
|
legalStatuses: ['amended'],
|
||||||
|
territories: [{ id: 'territory', name: 'Cabo Delgado' }],
|
||||||
|
resources: {
|
||||||
|
data: [],
|
||||||
|
total: 0,
|
||||||
|
prev_page_url: null,
|
||||||
|
next_page_url: null,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
test('biblioteca e legislação mantêm todos os critérios e opções visíveis no painel aberto', () => {
|
||||||
|
for (const section of ['documents', 'legislation']) {
|
||||||
|
const html = render(section);
|
||||||
|
for (const label of [
|
||||||
|
'Pesquisar',
|
||||||
|
'Tema',
|
||||||
|
'Fiscalidade',
|
||||||
|
'Categoria',
|
||||||
|
'Legislação',
|
||||||
|
'Tipo documental',
|
||||||
|
'Guia',
|
||||||
|
'Actividade ou CAE',
|
||||||
|
'CAE exemplo',
|
||||||
|
'Etapa do projecto',
|
||||||
|
'Etapa exemplo',
|
||||||
|
'Módulo',
|
||||||
|
'Simulador fiscal',
|
||||||
|
'Entidade emitente',
|
||||||
|
'Instituição exemplo',
|
||||||
|
'Idioma',
|
||||||
|
'Português',
|
||||||
|
'Situação jurídica indicada',
|
||||||
|
'Alterada; consulte alterações posteriores',
|
||||||
|
'Confirmação da fonte',
|
||||||
|
'Fonte oficial confirmada',
|
||||||
|
'Âmbito territorial',
|
||||||
|
'Cabo Delgado',
|
||||||
|
'Limpar filtros',
|
||||||
|
])
|
||||||
|
assert.ok(html.includes(label), `${section}: ${label}`);
|
||||||
|
assert.match(html, /aria-expanded="true"/);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('critérios seleccionados continuam acessíveis quando já não constam das opções', () => {
|
||||||
|
const html = render('documents', {
|
||||||
|
topic: 'Tema antigo',
|
||||||
|
activity: ['CAE antigo'],
|
||||||
|
stage: ['Etapa antiga'],
|
||||||
|
module: ['outro'],
|
||||||
|
territory_id: 'old-territory',
|
||||||
|
});
|
||||||
|
for (const value of [
|
||||||
|
'Tema antigo',
|
||||||
|
'CAE antigo',
|
||||||
|
'Etapa antiga',
|
||||||
|
'Documentos de apoio',
|
||||||
|
'old-territory',
|
||||||
|
'Localização seleccionada indisponível',
|
||||||
|
])
|
||||||
|
assert.ok(html.includes(value), value);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user