Skip to content

Commit

Permalink
Allow component render() to use cached HTML
Browse files Browse the repository at this point in the history
For tests using `getExamples()` we can use the pre-built YAML-to-JSON fixture HTML to speed things up
  • Loading branch information
colinrotherham committed Nov 1, 2023
1 parent 8a606fd commit fca508c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion shared/lib/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ function render(componentName, options) {
const macroName = componentNameToMacroName(componentName)
const macroPath = `govuk/components/${componentName}/macro.njk`

return renderMacro(macroName, macroPath, options)
// Return built fixture or render
return options?.fixture?.html ?? renderMacro(macroName, macroPath, options)
}

/**
Expand Down

0 comments on commit fca508c

Please sign in to comment.