Commit Graph

108 Commits

Author SHA1 Message Date
Tom Byers
efa892423a Fix issues raised on pull request
Includes:
- make 'remove team member' link, on edit member
  permissions page, destructive
- convert missed links on /features pages
- convert missed links on /using-notify/guidance and sub pages
- give links in browse-lists back their size and
  weight (needed for lists of live and trial
  services on Platform Admin)
- give links on Platform Admin inbound numbers
  page back their size and weight
- update links in JS tests
2020-02-25 10:52:03 +00:00
Tom Byers
5b306dde4d Revert "Convert all links to govuk frontend" 2020-02-24 11:56:38 +00:00
Tom Byers
97172cca30 Merge branch 'master' into convert-all-links-to-govuk-frontend 2020-02-24 10:12:58 +00:00
Tom Byers
8a98c73b08 Make analytics send the same title for all pages
Sets it on the tracker which means this value gets
sent for each:
- pageview
- event

See: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

We can only test that this has been set on the
tracker, not how that effects what is sent to GA,
in the JS tests.

This change has been tested in-browser with the
Chrome Analytics Debugger. This revealed the
contents of what is in the beacon sent to GA and
allowed confirmation the title was being set
correctly.

See: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna/related
2020-02-20 11:46:19 +00:00
Tom Byers
5459dd8c13 Fix issues raised on pull request
Includes:
- make 'remove team member' link, on edit member
  permissions page, destructive
- convert missed links on /features pages
- convert missed links on /using-notify/guidance and sub pages
- give links in browse-lists back their size and
  weight (needed for lists of live and trial
  services on Platform Admin)
- give links on Platform Admin inbound numbers
  page back their size and weight
- update links in JS tests
2020-02-20 09:19:06 +00:00
Katie Smith
e53a97423b Update radio-select to use govuk-frontend buttons 2020-02-17 08:05:05 +00:00
Katie Smith
0d0b71af63 Update buttons on api key pages to govuk-frontend buttons 2020-02-17 08:05:05 +00:00
Katie Smith
e53c5e17b3 Update file upload component to use govuk-frontend buttons 2020-02-17 08:05:05 +00:00
Katie Smith
2cbfaf1b6f Update the buttons on template folder form 2020-02-17 08:05:05 +00:00
Katie Smith
583a925e89 Add buttons for list entries
As part of updating the stylesheet, moved `.button-secondary` to the
global stylesheet, since this is not related to list entries but instead
affects all buttons with that class (this class wlil be removed once all
the buttons are using the new macro).
2020-02-17 08:05:05 +00:00
Katie Smith
4e42fa6f5d Update buttons for collapsible checkboxes
We use collapsible checkboxes when setting which folders team members
can see (on the manage folder page and on the edit team member page).
2020-02-17 08:05:05 +00:00
Katie Smith
ba8ac41953 Update Javascript tests
This only updates the JavaScript tests where we don't need to make changes to
the actual JavaScript too.
2020-02-17 08:05:05 +00:00
Leo Hemsted
5b868ff268 remove api keys from codebase
these are just used for tests so don't need to look like real api keys.
2020-02-04 14:44:19 +00:00
Tom Byers
d68403f7dc Merge pull request #3272 from alphagov/stop-removing-ga-cookies
Stop removing GA cookies
2020-01-23 11:32:42 +00:00
Tom Byers
cfdc83a336 Update tests 2020-01-22 12:26:55 +00:00
Tom Byers
174c10c7ff Clear old cookies to be based on consent
We have been clearing all the Google Analytics
cookies on each page request.

It is now possible for a user to consent to having
Google Analytics cookies so this should have been
checking for that before deleting them.

This makes that change, with tests for those
scenarios.
2020-01-22 12:14:23 +00:00
Tom Byers
98e48e68f9 Change the URL JSDOM uses for the current page
https://jestjs.io/docs/en/configuration#testurl-string

Affects all DOM APIs that return information about
the URL, for example window.location.

Why:

We now have tests for setting/deleting cookies.
Tough-cookie, the library JSDOM uses for cookie
handling cookies doesn't allow setting cookies
with `domain=localhost`. This is correct by
RFC6265, the standard it follows, as domains must
have 2 or more `.`s in them.

The only way to set a cookie on `localhost` is to
leave out the `domain` attribute.

The code we are testing sets and deletes cookies
set on specific domains so using `localhost` is
out.

We also cannot just set/delete cookies on the
domains used as cookies are required to match the
domain of the current page.

The solution we are left with is to set the
current page to one from production and make sure
each cookie is set relative to that domain.

Note: this introduces `testURL` in isolation to be
sure it doesn't break any existing tests.
2020-01-22 11:08:29 +00:00
Tom Byers
62f1c5a88e Fix associated test 2020-01-20 10:05:15 +00:00
Tom Byers
a67cd65f47 Make Google Analytics cookies expire in 1 year 2020-01-20 10:05:06 +00:00
Tom Byers
1d9c5e5da9 Default the cookie banner to be hidden
It should only be shown if JS is available and the
cookieMessage JS finds consent has not been set.
2020-01-20 10:04:58 +00:00
Tom Byers
1a97c6028c Add event tracking to window.GOVUK.analytics
app/assets/javascripts/errorTracking.js sent
events to `window.ga`.

This extends the API of `window.GOVUK.Analytics`
to include support for sending events so all
calls to `window.ga` can use it instead of direct
access.

This use of `window.ga` was missed from the
initial work on `window.GOVUK.Anaytics`.
2020-01-20 10:04:56 +00:00
Tom Byers
b17140ac46 Fix test description 2020-01-20 10:03:47 +00:00
Tom Byers
8a0d0a15a8 Hide cookie banner if no-js
Decided in discussions with @quis and @yahoopete
that users without JS available cannot
accept/reject analytics cookies so the banner has
no use.
2020-01-20 10:03:47 +00:00
Tom Byers
9a0d522964 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.
2020-01-20 10:03:36 +00:00
Leo Hemsted
66db735e09 Revert "Merge pull request #3238 from alphagov/cookies-update"
This reverts commit eec4bec761, reversing
changes made to 64480e2fff.
2020-01-15 14:40:48 +00:00
Tom Byers
b86398ddda Fix associated test 2020-01-15 12:03:44 +00:00
Tom Byers
dce6a46df6 Make Google Analytics cookies expire in 1 year 2020-01-14 14:16:00 +00:00
Tom Byers
c18cb1e984 Default the cookie banner to be hidden
It should only be shown if JS is available and the
cookieMessage JS finds consent has not been set.
2020-01-14 12:11:40 +00:00
Tom Byers
b6e37a6ac8 Add event tracking to window.GOVUK.analytics
app/assets/javascripts/errorTracking.js sent
events to `window.ga`.

This extends the API of `window.GOVUK.Analytics`
to include support for sending events so all
calls to `window.ga` can use it instead of direct
access.

This use of `window.ga` was missed from the
initial work on `window.GOVUK.Anaytics`.
2020-01-14 11:28:06 +00:00
Tom Byers
7d31431cef Fix test description 2020-01-08 17:48:37 +00:00
Tom Byers
f156fe2e95 Hide cookie banner if no-js
Decided in discussions with @quis and @yahoopete
that users without JS available cannot
accept/reject analytics cookies so the banner has
no use.
2020-01-08 10:23:52 +00:00
Tom Byers
900aa19bd3 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.
2020-01-06 13:38:34 +00:00
Tom Byers
c1b8fb7531 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-27 14:15:32 +00:00
Tom Byers
e09d510ab8 Revert "Replace govuk template with govuk frontend components - rewrite" 2019-11-26 12:14:09 +00:00
Tom Byers
2bd7ce8cf6 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-25 11:43:30 +00:00
Tom Byers
e02f94f238 Revert "Replace govuk template with govuk frontend components" 2019-11-25 10:37:35 +00:00
Tom Byers
c3b2d3c521 Replace all visually-hidden classes
These have been replaced:

https://design-system.service.gov.uk/get-started/updating-your-code/#helper-class-names
2019-11-22 17:45:45 +00:00
Tom Byers
059fb66fae Merge pull request #3173 from alphagov/dependabot/npm_and_yarn/jquery-3.4.1
Bump jquery from 1.12.4 to 3.4.1
2019-11-11 14:23:06 +00:00
Tom Byers
47781cc929 Change treatment of space character in URLs
jQuery changed it from using '+' to '%20' between
versions 1 and 3. This updates the test to match.
2019-11-11 12:08:21 +00:00
Tom Byers
2b5ba5f438 Use screenMock helper in fullscreenTable test 2019-11-08 17:37:06 +00:00
Tom Byers
e65946680a Use screenMock helper in API key test
jQuery 3 checks for any styles before dimension so
a value typical of the browser defaults needs to
be provided when mocking them.

This helps the mocking of `$.height` by providing
a default style for `height`.
2019-11-08 17:37:06 +00:00
Tom Byers
3fba2c381d Make screenMock helper mock more DOM APIs
jQuery 3 also calls `.getClientRects` to get the
position and dimension of elements.
2019-11-08 17:37:06 +00:00
Tom Byers
56a2aab5f0 Mock out getClientRects for tests that need it
jQuery 3 calls `getClientRects` in the
`.innerHeight` code. Version 1 didn't.

This mocks out those calls to the same as
`getCoundingClientRect`.
2019-11-08 17:37:06 +00:00
Chris Hill-Scott
6c0e853db4 Rename module
HighlightTags was bad because:
- we haven’t called placeholders ‘tags’ for a long time
- it also does resizing of the `<textarea>`, not just highlighting the
  placeholders
2019-10-31 17:53:44 +00:00
Chris Hill-Scott
d0ce4d07a3 Autosize textboxes w/out highlighting placeholders
Scrolling within textareas on the page is a bit grim. Which is why we
don’t do it for the textboxes that people use to edit templates.

This commit will allow us to extend the auto-resizing of `<textarea>`s
to those which don’t need the highlighting of placeholders.

The code is still quite coupled to the placeholder highlighting code,
because both work by copying the content of the `<textarea>` into a
`<div>` that underlaps the textbox. This `<div>` is used for both
rendering the placeholder highlights, and calculating the natural height
of the content. So it would be hard/confusing to split the two bits of
code into separate modules.
2019-10-31 17:53:44 +00:00
Tom Byers
d516c85279 Merge pull request #3105 from alphagov/add-js-tests-for-live-search
Add js tests for live search
2019-10-23 15:37:32 +01:00
Tom Byers
2a7f464df7 Merge pull request #3106 from alphagov/add-js-tests-for-preview-pane
Add js tests for preview pane
2019-10-23 15:22:23 +01:00
Tom Byers
d7b99c733d Merge pull request #3110 from alphagov/add-js-tests-for-update-content
Add JS tests for update content
2019-10-23 15:12:55 +01:00
Tom Byers
605f027c61 Add tests for highlight tags module 2019-10-03 07:59:19 +01:00
Tom Byers
2b3bfc109a Add tests for live-search module 2019-10-03 07:57:47 +01:00