Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tests for '{% call %}' use case for components that support it #510

Closed
NickColley opened this issue Feb 6, 2018 · 3 comments
Closed

Comments

@NickColley
Copy link
Contributor

NickColley commented Feb 6, 2018

Some of our components allow nesting using https://mozilla.github.io/nunjucks/templating.html#call.

We currently can't show this in the guide or tests, so this functionality could break.

For example #509 we do not have coverage for 'caller'

We would need to

  • Allow the review application to show 'caller' examples
  • Allow the tests to test 'caller' examples
@NickColley NickColley changed the title Allow testing of examples using 'caller' Allow testing of children using 'caller' in review application and tests Feb 6, 2018
@NickColley
Copy link
Contributor Author

NickColley commented Feb 6, 2018

I've spiked this out: https://github.com/alphagov/govuk-frontend/compare/spike-expose-caller-in-review?expand=1

You can see in the current way our application is structure it results in duplication of logic in three places.

I'd recommend we refactor app.js to remove complex data 'setting' in templates, and instead keep data at the top level passed down to templates.

Then share the rendering of components between the HTML Code examples, the iFrame preview and the test render helper.

@36degrees
Copy link
Contributor

As long as we have test coverage, I don't think we need to have examples in the review app, as neither the generated HTML nor the styling should differ from any other example.

So I'd suggest scoping this to just making sure we have tests that cover the {% call %} use case.

@36degrees 36degrees changed the title Allow testing of children using 'caller' in review application and tests Allow tests for '{% call %}' use case for components that support it Jul 30, 2018
@NickColley
Copy link
Contributor Author

This has been implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants