Add lawyer's view: a third field level and print mode (Fixes #29)
Fields and steps are Normal, Lawyer or Secret. Lawyer is stored as secret: true plus lawyer: true, so older builds treat it as a plain secret. Print offers masked, lawyer and complete views. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -170,3 +170,14 @@ test('sub-tabs: valid shapes pass, bad ones are reported', () => {
|
||||
d = good(); d.sections[1].records[0].subsection = 'x';
|
||||
assert.match(validate(d).join('\n'), /not one of this section's sub-tabs/);
|
||||
});
|
||||
|
||||
test('lawyer must be a boolean and needs secret: true, on fields and frames', () => {
|
||||
const withField = (f) => { const d = good(); d.sections[1].records[0].fields = [{ label: 'A', value: 'x', ...f }]; return d; };
|
||||
assert.deepEqual(validate(withField({ secret: true, lawyer: true })), []);
|
||||
assert.deepEqual(validate(withField({ secret: true, lawyer: false })), []);
|
||||
assert.match(validate(withField({ lawyer: true })).join('\n'), /lawyer needs secret: true/);
|
||||
assert.match(validate(withField({ secret: true, lawyer: 'yes' })).join('\n'), /lawyer must be a boolean/);
|
||||
const withFrame = (fr) => { const d = good(); d.sections[0].sequences = [{ id: 'q1', kind: 'sequence', title: 'Q', updated: '2022-04-14', frames: [{ image: '', text: 't', layout: 'none', ...fr }] }]; return d; };
|
||||
assert.deepEqual(validate(withFrame({ secret: true, lawyer: true })), []);
|
||||
assert.match(validate(withFrame({ lawyer: true })).join('\n'), /lawyer needs secret: true/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user