feat(editorial): preserve public portfolio fiches during private review
This commit is contained in:
@@ -24,6 +24,8 @@ const code = ts.transpileModule(source, {
|
||||
const module = { exports: {} };
|
||||
new Function('require', 'module', 'exports', code)(
|
||||
(name) => {
|
||||
if (name === '../portfolio/shared')
|
||||
return { labels: { description: 'Visão e proposta de valor' } };
|
||||
if (name === '@inertiajs/react')
|
||||
return {
|
||||
Link: ({ href, children, ...rest }) =>
|
||||
@@ -130,6 +132,11 @@ test('approved edition offers explicit publication; stale files and historical v
|
||||
});
|
||||
assert.match(stale, /Os anexos mudaram/);
|
||||
assert.doesNotMatch(stale, /value="publish"/);
|
||||
const staleReview = render({
|
||||
edition: { ...props.edition, state: 'in_review', fresh: false },
|
||||
});
|
||||
assert.match(staleReview, /value="return"/);
|
||||
assert.doesNotMatch(staleReview, /value="approve"/);
|
||||
const historical = render({ current: false });
|
||||
assert.match(historical, /Versão histórica para consulta/);
|
||||
assert.doesNotMatch(historical, /<form/);
|
||||
@@ -143,3 +150,57 @@ test('contributor does not see independent approval or legal-validation actions'
|
||||
assert.doesNotMatch(html, /value="(?:approve|legal_validate)"/);
|
||||
assert.match(html, /responsável independente/);
|
||||
});
|
||||
|
||||
test('portfolio edition reuses review screen with its own context, history and edit routes', () => {
|
||||
const html = render({
|
||||
subject: 'portfolio',
|
||||
resource: { ...props.resource, id: 'qa-dossier' },
|
||||
edition: {
|
||||
...props.edition,
|
||||
payload: {
|
||||
...props.edition.payload,
|
||||
resource: {
|
||||
title: 'Ficha privada',
|
||||
source: 'Fonte QA',
|
||||
content: { description: '<script>não executar</script>' },
|
||||
},
|
||||
files: [],
|
||||
links: [
|
||||
{
|
||||
target_type: 'projects',
|
||||
target_key: 'qa-project',
|
||||
context: { name: 'Projecto QA', code: 'QA-1' },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.match(html, /href="\/management\/portfolio\/qa-dossier"/);
|
||||
assert.match(
|
||||
html,
|
||||
/\/management\/editorial\/portfolio\/qa-dossier\?edition=qa-edition/,
|
||||
);
|
||||
assert.match(html, /Visão e proposta de valor/);
|
||||
assert.match(html, /Contexto: Projecto QA/);
|
||||
assert.doesNotMatch(html, /Alterar artigo|Alterar metadados\/documento/);
|
||||
assert.match(html, /<script>/);
|
||||
});
|
||||
|
||||
test('portfolio contributor cannot select publication of an approved edition', () => {
|
||||
assert.doesNotMatch(
|
||||
render({
|
||||
subject: 'portfolio',
|
||||
canApprove: false,
|
||||
edition: { ...props.edition, state: 'approved' },
|
||||
}),
|
||||
/value="publish"/,
|
||||
);
|
||||
assert.match(
|
||||
render({
|
||||
subject: 'portfolio',
|
||||
canApprove: true,
|
||||
edition: { ...props.edition, state: 'approved' },
|
||||
}),
|
||||
/value="publish"/,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user