govuk_frontend_toolkit 7.6.0 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/app/assets/.ruby-version +1 -1
- data/app/assets/CHANGELOG.md +37 -0
- data/app/assets/Gemfile +0 -1
- data/app/assets/Gruntfile.js +0 -3
- data/app/assets/README.md +7 -21
- data/app/assets/VERSION.txt +1 -1
- data/app/assets/docs/mixins.md +1 -1
- data/app/assets/javascripts/govuk/show-hide-content.js +1 -7
- data/app/assets/javascripts/stageprompt.js +7 -1
- data/app/assets/package-lock.json +2471 -0
- data/app/assets/spec/unit/show-hide-content.spec.js +57 -0
- data/app/assets/spec/unit/stageprompt.spec.js +170 -0
- data/app/assets/stylesheets/colours/_organisation.scss +1 -1
- data/govuk_frontend_toolkit.gemspec +0 -3
- data/publish.sh +1 -2
- metadata +5 -49
- data/Rakefile +0 -10
- data/app/assets/docs/analytics.md +0 -272
- data/app/assets/javascripts/govuk/analytics/analytics.js +0 -153
- data/app/assets/javascripts/govuk/analytics/download-link-tracker.js +0 -41
- data/app/assets/javascripts/govuk/analytics/error-tracking.js +0 -51
- data/app/assets/javascripts/govuk/analytics/external-link-tracker.js +0 -56
- data/app/assets/javascripts/govuk/analytics/google-analytics-universal-tracker.js +0 -176
- data/app/assets/javascripts/govuk/analytics/govuk-tracker.js +0 -134
- data/app/assets/javascripts/govuk/analytics/mailto-link-tracker.js +0 -38
- data/app/assets/javascripts/govuk/analytics/print-intent.js +0 -39
- data/app/assets/spec/unit/analytics/analytics.spec.js +0 -403
- data/app/assets/spec/unit/analytics/download-link-tracker.spec.js +0 -72
- data/app/assets/spec/unit/analytics/error-tracking.spec.js +0 -65
- data/app/assets/spec/unit/analytics/external-link-tracker.spec.js +0 -109
- data/app/assets/spec/unit/analytics/google-analytics-universal-tracker.spec.js +0 -187
- data/app/assets/spec/unit/analytics/govuk-tracker.spec.js +0 -171
- data/app/assets/spec/unit/analytics/mailto-link-tracker.spec.js +0 -62
@@ -1,62 +0,0 @@
|
|
1
|
-
/* global describe it expect afterEach beforeEach spyOn */
|
2
|
-
|
3
|
-
var $ = window.jQuery
|
4
|
-
|
5
|
-
describe('GOVUK.analyticsPlugins.mailtoLinkTracker', function () {
|
6
|
-
'use strict'
|
7
|
-
var GOVUK = window.GOVUK
|
8
|
-
|
9
|
-
var $links
|
10
|
-
|
11
|
-
beforeEach(function () {
|
12
|
-
$links = $(
|
13
|
-
'<div class="mailto-links">' +
|
14
|
-
'<a href="mailto:name1@email.com"></a>' +
|
15
|
-
'<a href="mailto:name2@email.com">The link for a mailto</a>' +
|
16
|
-
'<a href="mailto:name3@email.com"><img src="/img" /></a>' +
|
17
|
-
'</div>'
|
18
|
-
)
|
19
|
-
|
20
|
-
$('html').on('click', function (evt) { evt.preventDefault() })
|
21
|
-
$('body').append($links)
|
22
|
-
GOVUK.analytics = {trackEvent: function () {}}
|
23
|
-
|
24
|
-
GOVUK.analyticsPlugins.mailtoLinkTracker()
|
25
|
-
})
|
26
|
-
|
27
|
-
afterEach(function () {
|
28
|
-
$('html').off()
|
29
|
-
$('body').off()
|
30
|
-
$links.remove()
|
31
|
-
delete GOVUK.analytics
|
32
|
-
})
|
33
|
-
|
34
|
-
it('listens to click events on mailto links', function () {
|
35
|
-
spyOn(GOVUK.analytics, 'trackEvent')
|
36
|
-
|
37
|
-
$('.mailto-links a').each(function () {
|
38
|
-
$(this).trigger('click')
|
39
|
-
expect(GOVUK.analytics.trackEvent).toHaveBeenCalled()
|
40
|
-
GOVUK.analytics.trackEvent.calls.reset()
|
41
|
-
})
|
42
|
-
})
|
43
|
-
|
44
|
-
it('tracks mailto addresses and link text', function () {
|
45
|
-
spyOn(GOVUK.analytics, 'trackEvent')
|
46
|
-
$('.mailto-links a').trigger('click')
|
47
|
-
|
48
|
-
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
49
|
-
'Mailto Link Clicked', 'mailto:name1@email.com', {transport: 'beacon'})
|
50
|
-
|
51
|
-
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
52
|
-
'Mailto Link Clicked', 'mailto:name2@email.com', {transport: 'beacon', label: 'The link for a mailto'})
|
53
|
-
})
|
54
|
-
|
55
|
-
it('listens to click events on elements within mailto links', function () {
|
56
|
-
spyOn(GOVUK.analytics, 'trackEvent')
|
57
|
-
|
58
|
-
$('.mailto-links a img').trigger('click')
|
59
|
-
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
60
|
-
'Mailto Link Clicked', 'mailto:name3@email.com', {transport: 'beacon'})
|
61
|
-
})
|
62
|
-
})
|