Skip to content
Astera Technology

Render empty and populated document repeat blocks

Remove an empty repeat block while retaining the separate required footer.

Download complete case notes and answer keys ↓

Set the decision and its input

This synthetic document requires a footer independently of its line list. With zero lines the entire repeat section is absent. A faulty fallback creates a line saying Empty, changing the document structure. One and three supplied lines should produce exactly one and three rendered line elements.

Filled local test worksheet
CaseInput JSON
Base test{"lines":[]}
Download editable CSV ↓

Run the supplied comparison

The example creates and queries an actual isolated DOM. Section presence, line count and footer text are inspected together; an empty data array alone does not prove the generated document is correct.

Faulty and required outputs
PathOutput JSON
Faulty path{"repeatPresent":true,"lineCount":1,"footer":"Required footer"}
Required path{"repeatPresent":false,"lineCount":0,"footer":"Required footer"}
Download editable CSV ↓
Node24.14.1 programme; Playwright1.63 Chromium required
import assert from 'node:assert/strict';
import {createRequire} from 'node:module';
const htmlEscape=s=>String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
async function withPage(action,options={}){
  const require=createRequire(import.meta.url);const {chromium}=require('playwright');
  const browser=await chromium.launch({headless:true});
  try{const context=await browser.newContext(options);const page=await context.newPage();
    const requests=[];await page.route('**/*',route=>{requests.push(route.request().url());return route.abort();});
    return await action(page,context,requests);
  }finally{await browser.close();}
}

const run=async function run(i,corrected=true){
    return withPage(async page=>{const lines=i.lines.length?i.lines:corrected?[]:['Empty'];
      await page.setContent((lines.length?'<section id="repeat">'+lines.map(x=>'<p class="line">'+htmlEscape(x)+'</p>').join('')+'</section>':'')+'<footer>Required footer</footer>');
      return page.evaluate(()=>({repeatPresent:!!document.querySelector('#repeat'),lineCount:document.querySelectorAll('.line').length,footer:document.querySelector('footer').textContent}));});
  };
const cases=[{"input":{"lines":[]},"corrected":false,"expected":{"repeatPresent":true,"lineCount":1,"footer":"Required footer"}},{"input":{"lines":[]},"corrected":true,"expected":{"repeatPresent":false,"lineCount":0,"footer":"Required footer"}},{"input":{"lines":["A"]},"corrected":true,"expected":{"repeatPresent":true,"lineCount":1,"footer":"Required footer"}},{"input":{"lines":["A","B","C"]},"corrected":true,"expected":{"repeatPresent":true,"lineCount":3,"footer":"Required footer"}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

Populated boundaries retain the repeat section and the same footer. No blank business line is inserted merely to make a template render.

  1. Separate repeat and fixed regions
  2. Render the supplied list
  3. Inspect the resulting DOM

Do not replace missing lines with invented placeholders.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
one real line{"lines":["A"]}{"repeatPresent":true,"lineCount":1,"footer":"Required footer"}
three real lines{"lines":["A","B","C"]}{"repeatPresent":true,"lineCount":3,"footer":"Required footer"}
Download editable CSV ↓

What structure is required for the base empty list?

Show the worked answer

No repeat section and zero line elements, with Required footer still present. The footer is not conditional on line count.

Related resources