0.0.0 • Published 3 years ago

govuk-insert-dummy-data-test v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

govuk-insert-dummy-data

JavaScript function for inserting dummy data in the GOV.UK Prototype Kit.

demo gif

Table of contents

Why was this made?

This function has been in use in some form or another since 2016. After copying and pasting from one project to another I decided to make something more configurable so there would be less code to change on each use.

This function makes it quick and easy to navigate a prototype that requires a value or a valid value to continue to next page.

Made with

JavaScript

Features

  • insert single values

  • insert multiple values

  • use any visible element as trigger

Requirements

None

How to use

Include the script

Inserting dummy data

Single value

Add the insertDummyData() function at the bottom of your page.

Multiple values

Add the dummyData array and sendDummyData() function at the bottom of your page.

Check one checkbox or radio

Similar to inserting a single value, add the insertDummyData() function at the bottom of the page.

Check multiple checkboxes

Similar to inserting multiple values, add the dummyData array and sendDummyData() function at the bottom of the page.

Examples

Inserting dummy data

Single value

Add the id attribute of the input and the value to be inserted.

Multiple values

For each input you want to fill add the id attribute of the input and the value to be inserted.

Check one checkbox or radio

Add the id attribute of the checkbox or radio to be checked.

Check multiple checkboxes

Add the id attributes of the checkboxes to be checked.