Add JS tests for analytics & cookies JS

Includes:
- tests for the analytics interface ported from
  GOVUK Frontend Toolkit
- tests for the cookie banner that appears on all
  pages except the cookies page
- tests for the cookies page JS
- tests for the hasConsentFor function
- adding a deleteCookie helper to remove
  cookies during tests
- polyfill for insertAdjacentText

The last one is because JSDOM doesn't support
insertAdjacentText but our target browsers
do. This polyfill also includes one for
insertAdjacentHTML.
This commit is contained in:
Tom Byers
2019-12-31 16:49:52 +00:00
parent beeb273d6c
commit 900aa19bd3
9 changed files with 841 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
// Polyfill holes in JSDOM
require('./polyfills.js');
// set up jQuery
window.jQuery = require('jquery');
$ = window.jQuery;