Lot U : le lecteur refait — l'ordre en une ligne au bout de sa section, poignées sur place (Reorder), le titre et l'ordre votés à leur place ; Propositions seed en tête quand rien n'est en vigueur ; Propositions en cours repliées par section ; panneau sans onglets ; oui pour passer · non pour bloquer ; quorum de l'auteur ; votes simulés dits simulés

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-11-03 07:59:24 +01:00
co-authored by Claude Opus 5.5
parent 70f7bb7247
commit 4cf4e47ee9
17 changed files with 1198 additions and 541 deletions
+30 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { Proposal, Unit } from '../../src/lib/types';
import { articles, excerpts, level } from '../../src/lib/versions';
import { articles, deepSections, excerpts, level } from '../../src/lib/versions';
function prop(id: string, unitId: string, over: Partial<Proposal> = {}): Proposal {
return {
@@ -96,3 +96,32 @@ describe('the versions of an article', () => {
expect(excerpts(['Seule.'])).toEqual(['Seule.']);
});
});
describe('the open proposals by section (lot U)', () => {
const inSection = (u: Unit, section: string | null): Unit => ({ ...u, section });
it('each section holds its articles in document order, and its order when it closes there', () => {
const t1 = inSection(unit('T1', [prop('t1', 'T1')]), 'technique');
const c1 = inSection(unit('C1', [prop('c1', 'C1')]), 'conclusion');
const t2 = inSection(unit('T2', [prop('t2', 'T2')]), 'technique');
const order = { ...inSection(unit('O', []), 'technique'), kind: 'order' as const };
const list = deepSections(articles(items(t1, t2, c1)), [order], ['introduction', 'technique', 'conclusion']);
expect(list.map((s) => s.key)).toEqual(['technique', 'conclusion']);
expect(at(list, 0).articles.map((a) => a.unit.id)).toEqual(['T1', 'T2']);
expect(at(list, 0).order?.id).toBe('O');
expect(at(list, 1).order).toBeUndefined();
});
it('a section with only its order to show is kept, at its place in the document', () => {
const c1 = inSection(unit('C1', [prop('c1', 'C1')]), 'conclusion');
const order = { ...inSection(unit('O', []), 'introduction'), kind: 'order' as const };
const list = deepSections(articles(items(c1)), [order], ['introduction', 'conclusion']);
expect(list.map((s) => [s.key, s.articles.length, s.order?.id ?? null])).toEqual([
['introduction', 0, 'O'],
['conclusion', 1, null],
]);
});
it('the articles without a section come after the sections the document lists', () => {
const loose = unit('N1', [prop('n1', 'N1')]);
const c1 = inSection(unit('C1', [prop('c1', 'C1')]), 'conclusion');
expect(deepSections(articles(items(loose, c1)), [], ['conclusion']).map((s) => s.key)).toEqual(['conclusion', null]);
});
});