govuk_frontend_toolkit 4.18.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed31373cbe3fd29495e7825368045f0961c44b00
4
- data.tar.gz: 5e1914525810948b8ea7ebeb6a863500c3b8dc7e
3
+ metadata.gz: ff8f1703a8d15e9962e1a8c93c443accd075c4c6
4
+ data.tar.gz: a494d718895df6b12456aad04b7dd88ad91990d6
5
5
  SHA512:
6
- metadata.gz: 6de494a693da9ee1f4650cec2e256de23b91b46627f035e7d688e4ab4625e9dfce928809b6f1ae921e32879bf8de4a32f5492111fe37f88e1742047510128e5c
7
- data.tar.gz: 1581b99971f60eebab602605fe1bc1de2e32b69ccec3b4d00653759b9e8f000e76c63d5c3543f08829958e2bebf9bb045f51bf6410a8b19e7b669b4c260f5f34
6
+ metadata.gz: d780600b4e3d022d7c7ca4ba0a9bf093f5a87d1c89e98362f51db2441132a0c5e12d4b89d686d3ca4c4efe6dcdb8db36add955f8d21c123e5231b12a190f6593
7
+ data.tar.gz: 3899d64d9b3d12e427ba54b728767af1ed1e6a709bd68c140b4a2ef9045b140ed23ec03a5d0a1ce7614c99230251c83d88cb080acbb58bfc65377fc521b07250
@@ -1,3 +1,12 @@
1
+ # 5.0.0
2
+
3
+ This release includes two breaking changes:
4
+ - Removal of external link styles and icons, if you are using the external-link-* mixins you will need to remove them from your codebase ([PR #293](https://github.com/alphagov/govuk_frontend_toolkit/pull/293))
5
+ - Correct spelling of the 'accordion' icon, you will need to check for the incorrect spelling 'accordian' and update if you are using this icon ([PR #345](https://github.com/alphagov/govuk_frontend_toolkit/pull/345))
6
+ And two minor changes:
7
+ - Amend GOVUK.StickAtTopWhenScrolling to resize the sticky element and shim when the .js-sticky-resize class is set ([PR #343](https://github.com/alphagov/govuk_frontend_toolkit/pull/343))
8
+ - Allow custom options in GOVUK.analytics.trackPageview ([#332](https://github.com/alphagov/govuk_frontend_toolkit/pull/332))
9
+
1
10
  # 4.18.4
2
11
 
3
12
  - Lint codebase using standard ([PR #334](https://github.com/alphagov/govuk_frontend_toolkit/pull/334))
@@ -1 +1 @@
1
- 4.18.4
1
+ 5.0.0
@@ -74,6 +74,11 @@ GOVUK.analytics.trackPageview('/path');
74
74
 
75
75
  // Track a custom path and custom page title
76
76
  GOVUK.analytics.trackPageview('/path', 'Title');
77
+
78
+ // As above, plus additional options passed into the `pageview` call
79
+ GOVUK.analytics.trackPageview('/path', 'Title', {
80
+ sessionControl: 'start'
81
+ });
77
82
  ```
78
83
 
79
84
  ## Custom events
@@ -378,61 +378,6 @@ Tabular numbers have numerals of a standard fixed width. As all numbers have the
378
378
 
379
379
  [See an example of tabular numbers in a table](http://govuk-elements.herokuapp.com/data/#data-table-numeric)
380
380
 
381
- #### external links
382
-
383
- `external-link-default` sets up the background image for all external links.
384
- This should be included on the default link style for a project.
385
-
386
- After setting the default, apply includes from the following for different font sizes:
387
-
388
- * `external-link-12`
389
- * `external-link-12-no-hover`
390
- * `external-link-13`
391
- * `external-link-13-no-hover`
392
- * `external-link-14`
393
- * `external-link-14-bold-no-hover`
394
- * `external-link-16`
395
- * `external-link-16-bold-no-hover`
396
- * `external-link-19`
397
- * `external-link-19-no-hover`
398
-
399
- `external-link-heading` is a unique style a background image for headings to groups of external links.
400
-
401
- This uses the `file-url` helper which will by default output an `image-url` to
402
- be used with Compass or Rails Asset Pipeline, if you want to use a static path
403
- then set the `$path` variable to point to the public location of the toolkit
404
- image assets.
405
-
406
- #### Description
407
-
408
- For a set style:
409
-
410
- `@include external-link-[style]`
411
-
412
- For a specific font size:
413
-
414
- `@include external-link-[size]-[weight]-[no-hover]`
415
-
416
- #### Usage
417
-
418
- /* Default link style */
419
- a[rel="external"] {
420
- @include external-link-default;
421
- @include external-link-19;
422
- }
423
-
424
- th.external-link {
425
- @include external-link-heading;
426
- }
427
-
428
- .inner a[rel="external"] {
429
- @include external-link-16;
430
- }
431
-
432
- .departments a[rel="external"] {
433
- @include external-link-16-bold-no-hover;
434
- }
435
-
436
381
  ### <a id="css3"></a>css3
437
382
 
438
383
  CSS3 helpers to abstract vendor prefixes.
@@ -1,6 +1,7 @@
1
1
  ;(function (global) {
2
2
  'use strict'
3
3
 
4
+ var $ = global.jQuery
4
5
  var GOVUK = global.GOVUK || {}
5
6
 
6
7
  var GoogleAnalyticsUniversalTracker = function (trackingId, fieldsObject) {
@@ -34,24 +35,24 @@
34
35
 
35
36
  // https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
36
37
  GoogleAnalyticsUniversalTracker.prototype.trackPageview = function (path, title, options) {
37
- options = options || {}
38
+ var pageviewObject
38
39
 
39
40
  if (typeof path === 'string') {
40
- var pageviewObject = {
41
- page: path
42
- }
41
+ pageviewObject = { page: path }
42
+ }
43
43
 
44
- if (typeof title === 'string') {
45
- pageviewObject.title = title
46
- }
44
+ if (typeof title === 'string') {
45
+ pageviewObject = pageviewObject || {}
46
+ pageviewObject.title = title
47
+ }
47
48
 
48
- // Set the transport method for the pageview
49
- // Typically used for enabling `navigator.sendBeacon` when the page might be unloading
50
- // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
51
- if (options.transport) {
52
- pageviewObject.transport = options.transport
53
- }
49
+ // Set an options object for the pageview (e.g. transport, sessionControl)
50
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
51
+ if (typeof options === 'object') {
52
+ pageviewObject = $.extend(pageviewObject || {}, options)
53
+ }
54
54
 
55
+ if (!$.isEmptyObject(pageviewObject)) {
55
56
  sendToGa('send', 'pageview', pageviewObject)
56
57
  } else {
57
58
  sendToGa('send', 'pageview')
@@ -91,6 +91,15 @@
91
91
  sticky.$els.each(function (i, el) {
92
92
  var $el = $(el)
93
93
 
94
+ var elResize = $el.hasClass('js-sticky-resize')
95
+ if (elResize) {
96
+ var $shim = $('.shim')
97
+ var $elParent = $el.parent('div')
98
+ var elParentWidth = $elParent.width()
99
+ $shim.css('width', elParentWidth)
100
+ $el.css('width', elParentWidth)
101
+ }
102
+
94
103
  if (windowDimensions.width <= 768) {
95
104
  sticky.release($el)
96
105
  }
@@ -67,6 +67,11 @@ describe('GOVUK.GoogleAnalyticsUniversalTracker', function () {
67
67
  expect(window.ga.calls.mostRecent().args).toEqual(['send', 'pageview'])
68
68
  })
69
69
 
70
+ it('sends them to Google Analytics, forcing a new session', function () {
71
+ universal.trackPageview(undefined, undefined, { sessionControl: 'start' })
72
+ expect(window.ga.calls.mostRecent().args).toEqual(['send', 'pageview', {sessionControl: 'start'}])
73
+ })
74
+
70
75
  it('can track a virtual pageview', function () {
71
76
  universal.trackPageview('/nicholas-page')
72
77
  expect(window.ga.calls.mostRecent().args).toEqual(['send', 'pageview', {page: '/nicholas-page'}])
@@ -80,6 +80,25 @@ describe('stick-at-top-when-scrolling', function () {
80
80
  expect($stickyElement.hasClass('content-fixed')).toBe(true)
81
81
  })
82
82
 
83
+ it('should check the width of the parent, and make the width of the element and the shim the same on resize', function () {
84
+ var $stickyResizeElement = $('<div class="stick-at-top-when-scrolling js-sticky-resize"></div>')
85
+ var $stickyResizeWrapper = $('<div class="column-third" style="width:300px;">').append($stickyResizeElement)
86
+ $('body').append($stickyResizeWrapper)
87
+
88
+ GOVUK.stickAtTopWhenScrolling.$els = $stickyResizeElement
89
+ GOVUK.stickAtTopWhenScrolling._hasResized = true
90
+ GOVUK.stickAtTopWhenScrolling.checkResize()
91
+
92
+ var stickyElementParentWidth = $stickyResizeElement.parent('div').width()
93
+ expect(stickyElementParentWidth).toBe(300)
94
+
95
+ var stickyElementWidth = $stickyResizeElement.width()
96
+ expect(stickyElementWidth).toBe(300)
97
+
98
+ var stickElementShimWidth = $('.shim').width()
99
+ expect(stickElementShimWidth).toBe(300)
100
+ })
101
+
83
102
  it('should unstick, if the scroll position is less than the point at which scrolling started', function () {
84
103
  GOVUK.stickAtTopWhenScrolling.getWindowPositions = function () {
85
104
  return {
@@ -247,90 +247,3 @@ $is-print: false !default;
247
247
  padding-bottom: 5px;
248
248
  }
249
249
  }
250
-
251
- // External link styles for all font sizes
252
-
253
- // Private mixin for use solely by those below
254
-
255
- @mixin external-link-size($content, $top, $top-hover: top) {
256
- &:after {
257
- content: $content;
258
- background-position: right $top;
259
- }
260
-
261
- @if $top-hover == top {
262
- $top-hover: $top;
263
- }
264
-
265
- &:hover:after {
266
- background-position: right $top-hover;
267
- }
268
- }
269
-
270
- @mixin external-link-12-no-hover {
271
- @include external-link-size($content: "\A0\A0\A0\A0\A0\A0\A0\A0", $top: 0);
272
- }
273
-
274
- @mixin external-link-12 {
275
- @include external-link-size($content: "\A0\A0\A0\A0\A0\A0\A0\A0", $top: 0, $top-hover: -388px);
276
- }
277
-
278
- @mixin external-link-13-no-hover {
279
- @include external-link-size($content: "\A0\A0\A0\A0\A0", $top: 1px);
280
- }
281
-
282
- @mixin external-link-13 {
283
- @include external-link-size($content: "\A0\A0\A0\A0\A0", $top: 1px, $top-hover: -387px);
284
- }
285
-
286
- @mixin external-link-14 {
287
- @include external-link-size($content: "\A0\A0\A0\A0\A0", $top: 1px, $top-hover: -387px);
288
- }
289
-
290
- @mixin external-link-14-bold-no-hover {
291
- @include external-link-size($content: "\A0\A0\A0\A0\A0\A0", $top: 2px);
292
- }
293
-
294
- @mixin external-link-16 {
295
- @include external-link-size($content: "\A0\A0\A0\A0\A0", $top: 3px, $top-hover: -385px);
296
- }
297
-
298
- @mixin external-link-16-bold-no-hover {
299
- @include external-link-size($content: "\A0\A0\A0\A0\A0\A0", $top: 3px);
300
- }
301
-
302
- @mixin external-link-19-no-hover {
303
- @include external-link-size($content: "\A0\A0\A0\A0", $top: 6px);
304
- }
305
-
306
- @mixin external-link-19 {
307
- @include external-link-size($content: "\A0\A0\A0\A0", $top: 6px, $top-hover: -382px);
308
- }
309
-
310
- @mixin external-link-19-bold-no-hover {
311
- @include external-link-size($content: "\A0\A0\A0\A0\A0\A0", $top: 6px);
312
- }
313
-
314
- @mixin external-link-default {
315
- &:after {
316
- background-image: file-url("external-links/external-link.png");
317
- background-repeat: no-repeat;
318
-
319
- @include device-pixel-ratio() {
320
- background-image: file-url("external-links/external-link-24x24.png");
321
- background-size: 12px 400px;
322
- }
323
- }
324
- }
325
-
326
- @mixin external-link-heading {
327
- &:after {
328
- background-image: file-url("external-links/external-link-black-12x12.png");
329
- background-repeat: no-repeat;
330
-
331
- @include device-pixel-ratio() {
332
- background-image: file-url("external-links/external-link-black-24x24.png");
333
- background-size: 12px 400px;
334
- }
335
- }
336
- }
@@ -126,14 +126,6 @@
126
126
  }
127
127
  }
128
128
 
129
- // Reset styles applied to external links
130
- &[rel="external"]:after {
131
- display: none;
132
- content: none;
133
- margin-left: 0;
134
- margin-right: 0;
135
- }
136
-
137
129
  // Fixes a bug where IE puts a black border around certain elements
138
130
  @include ie-lte(8) {
139
131
  &[type="submit"],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_frontend_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.4
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -96,8 +96,8 @@ files:
96
96
  - app/assets/docs/functions.md
97
97
  - app/assets/docs/javascript.md
98
98
  - app/assets/docs/mixins.md
99
- - app/assets/images/accordian-arrow-2x.png
100
- - app/assets/images/accordian-arrow.png
99
+ - app/assets/images/accordion-arrow-2x.png
100
+ - app/assets/images/accordion-arrow.png
101
101
  - app/assets/images/arrow-sprite.png
102
102
  - app/assets/images/crests/bis_crest_13px.png
103
103
  - app/assets/images/crests/bis_crest_13px_x2.png
@@ -171,10 +171,6 @@ files:
171
171
  - app/assets/images/crests/wales_crest_18px_x2.png
172
172
  - app/assets/images/crests/wales_crest_27px.png
173
173
  - app/assets/images/crests/wales_crest_27px_x2.png
174
- - app/assets/images/external-links/external-link-24x24.png
175
- - app/assets/images/external-links/external-link-black-12x12.png
176
- - app/assets/images/external-links/external-link-black-24x24.png
177
- - app/assets/images/external-links/external-link.png
178
174
  - app/assets/images/icon-arrow-left.png
179
175
  - app/assets/images/icon-calendar-2x.png
180
176
  - app/assets/images/icon-calendar.png