govuk_frontend_toolkit 4.2.0 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
data/app/assets/CHANGELOG.md
CHANGED
data/app/assets/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.2.
|
1
|
+
4.2.1
|
@@ -12,9 +12,14 @@
|
|
12
12
|
function trackDownload(evt) {
|
13
13
|
var $link = getLinkFromEvent(evt),
|
14
14
|
href = $link.attr('href'),
|
15
|
+
evtOptions = {transport: 'beacon'},
|
15
16
|
linkText = $.trim($link.text());
|
16
17
|
|
17
|
-
|
18
|
+
if (linkText) {
|
19
|
+
evtOptions.label = linkText;
|
20
|
+
}
|
21
|
+
|
22
|
+
GOVUK.analytics.trackEvent('Download Link Clicked', href, evtOptions);
|
18
23
|
}
|
19
24
|
|
20
25
|
function getLinkFromEvent(evt) {
|
data/app/assets/jenkins.sh
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
set -e
|
3
3
|
|
4
|
+
bundle install
|
4
5
|
npm install
|
5
6
|
npm test
|
6
7
|
|
@@ -12,7 +13,7 @@ MASTER_SHA=`git rev-parse origin/master`
|
|
12
13
|
HEAD_SHA=`git rev-parse HEAD`
|
13
14
|
if [ "$MASTER_SHA" == "$HEAD_SHA" ]; then
|
14
15
|
# get the version from the version file
|
15
|
-
VERSION_TAG="v`cat VERSION.
|
16
|
+
VERSION_TAG="v`cat VERSION.txt`"
|
16
17
|
|
17
18
|
# check to make sure the tag doesn't already exist
|
18
19
|
if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then
|
@@ -16,7 +16,7 @@ describe("GOVUK.analyticsPlugins.downloadLinkTracker", function() {
|
|
16
16
|
|
17
17
|
$('html').on('click', function(evt) { evt.preventDefault(); });
|
18
18
|
$('body').append($links);
|
19
|
-
GOVUK.analytics = {
|
19
|
+
GOVUK.analytics = {trackEvent:function(){}};
|
20
20
|
GOVUK.analyticsPlugins.downloadLinkTracker({selector: 'a[href$=".pdf"], a[href$=".xslt"], a[href$=".doc"], a[href$=".png"]'});
|
21
21
|
});
|
22
22
|
|
@@ -28,34 +28,37 @@ describe("GOVUK.analyticsPlugins.downloadLinkTracker", function() {
|
|
28
28
|
});
|
29
29
|
|
30
30
|
it('listens to clicks on links that match the selector', function() {
|
31
|
-
spyOn(GOVUK.analytics, '
|
31
|
+
spyOn(GOVUK.analytics, 'trackEvent');
|
32
32
|
|
33
33
|
$('.download-links a').each(function() {
|
34
34
|
$(this).trigger('click');
|
35
|
-
expect(GOVUK.analytics.
|
36
|
-
GOVUK.analytics.
|
35
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalled();
|
36
|
+
GOVUK.analytics.trackEvent.calls.reset();
|
37
37
|
});
|
38
38
|
|
39
39
|
$('.normal-links a').each(function() {
|
40
40
|
$(this).trigger('click');
|
41
|
-
expect(GOVUK.analytics.
|
42
|
-
GOVUK.analytics.
|
41
|
+
expect(GOVUK.analytics.trackEvent).not.toHaveBeenCalled();
|
42
|
+
GOVUK.analytics.trackEvent.calls.reset();
|
43
43
|
});
|
44
44
|
});
|
45
45
|
|
46
46
|
it('listens to click events on elements within download links', function() {
|
47
|
-
spyOn(GOVUK.analytics, '
|
47
|
+
spyOn(GOVUK.analytics, 'trackEvent');
|
48
48
|
|
49
49
|
$('.download-links a img').trigger('click');
|
50
|
-
expect(GOVUK.analytics.
|
50
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith('Download Link Clicked', '/an/image/link.png', {transport: 'beacon'});
|
51
51
|
});
|
52
52
|
|
53
|
-
it('tracks a download link as
|
54
|
-
spyOn(GOVUK.analytics, '
|
53
|
+
it('tracks a download link as an event with link text as the label', function() {
|
54
|
+
spyOn(GOVUK.analytics, 'trackEvent');
|
55
55
|
$('.download-links a').trigger('click');
|
56
56
|
|
57
|
-
expect(GOVUK.analytics.
|
58
|
-
|
59
|
-
expect(GOVUK.analytics.
|
57
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
58
|
+
'Download Link Clicked', '/one.pdf', {label: 'PDF', transport: 'beacon'});
|
59
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
60
|
+
'Download Link Clicked', '/two.xslt', {label: 'Spreadsheet', transport: 'beacon'});
|
61
|
+
expect(GOVUK.analytics.trackEvent).toHaveBeenCalledWith(
|
62
|
+
'Download Link Clicked', '/something/uploads/system/three.doc', {label: 'Document', transport: 'beacon'});
|
60
63
|
});
|
61
64
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_frontend_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -290,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
290
|
version: '0'
|
291
291
|
segments:
|
292
292
|
- 0
|
293
|
-
hash:
|
293
|
+
hash: 1621947879198533180
|
294
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
295
|
none: false
|
296
296
|
requirements:
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: '0'
|
300
300
|
segments:
|
301
301
|
- 0
|
302
|
-
hash:
|
302
|
+
hash: 1621947879198533180
|
303
303
|
requirements: []
|
304
304
|
rubyforge_project:
|
305
305
|
rubygems_version: 1.8.23
|