govuk_frontend_toolkit 4.16.1 → 4.17.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 814dd64f724ed55761b47722aac9ba2a35904b99
|
4
|
+
data.tar.gz: c06eca3d6fee3ac3ef3bd036ddd2183e23854037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e858e46f18e4f819a793f64ef6b490153a906d4ce39903be37a740aa72cbecf9831bfee32819258d88c65ec9408687623d257bb4bd72bf30e9775428858da5be
|
7
|
+
data.tar.gz: d2f9dff826f282602071b32f40873fd642e8fb72513e862d61ae82863c05ffbbfbf650969233d35bcccf6cc4be9640a87f35a40b0c6977d1c5ca85428e96de41
|
data/app/assets/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 4.17.0
|
2
|
+
|
3
|
+
- SelectionButtons will add a class to the label with the type of the child input ([PR #317](https://github.com/alphagov/govuk_frontend_toolkit/pull/317))
|
4
|
+
|
1
5
|
# 4.16.1
|
2
6
|
|
3
7
|
- Fix anchor-buttons.js to trigger a native click event, also rename to shimLinksWithButtonRole.js to explain what it does
|
data/app/assets/README.md
CHANGED
@@ -141,6 +141,7 @@ In production:
|
|
141
141
|
* [Primary links](/docs/javascript.md#primary-links)
|
142
142
|
* [Stick at top when scrolling](/docs/javascript.md#stick-at-top-when-scrolling)
|
143
143
|
* [Selection buttons](/docs/javascript.md#selection-buttons)
|
144
|
+
* [Shim links with button role](/docs/javascript.md#shim-links-with-button-role)
|
144
145
|
* [Analytics](/docs/analytics.md)
|
145
146
|
* [Create an analytics tracker](/docs/analytics.md#create-an-analytics-tracker)
|
146
147
|
* [Virtual pageviews](/docs/analytics.md#virtual-pageviews)
|
data/app/assets/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.17.0
|
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
this.selectedClass = 'selected';
|
10
10
|
this.focusedClass = 'focused';
|
11
|
+
this.radioClass = 'selection-button-radio';
|
12
|
+
this.checkboxClass = 'selection-button-checkbox';
|
11
13
|
if (opts !== undefined) {
|
12
14
|
$.each(opts, function (optionName, optionObj) {
|
13
15
|
this[optionName] = optionObj;
|
@@ -33,6 +35,8 @@
|
|
33
35
|
$elms.each(function (idx, elm) {
|
34
36
|
var $elm = $(elm);
|
35
37
|
|
38
|
+
var labelClass = $elm.attr('type') === 'radio' ? this.radioClass : this.checkboxClass;
|
39
|
+
$elm.parent('label').addClass(labelClass);
|
36
40
|
if ($elm.is(':checked')) {
|
37
41
|
this.markSelected($elm);
|
38
42
|
}
|
@@ -337,7 +337,14 @@ describe("selection-buttons", function () {
|
|
337
337
|
});
|
338
338
|
|
339
339
|
describe("At the point it is called", function () {
|
340
|
-
it("Should
|
340
|
+
it("Should mark radios with the selection-button-radio class", function () {
|
341
|
+
buttonsInstance = new GOVUK.SelectionButtons("label.selectable input[type='radio']");
|
342
|
+
expect($radioLabels.eq(0).hasClass('selection-button-radio')).toBe(true);
|
343
|
+
expect($radioLabels.eq(1).hasClass('selection-button-radio')).toBe(true);
|
344
|
+
expect($radioLabels.eq(2).hasClass('selection-button-radio')).toBe(true);
|
345
|
+
});
|
346
|
+
|
347
|
+
it("Should not add a selected class if no radios are checked", function () {
|
341
348
|
buttonsInstance = new GOVUK.SelectionButtons("label.selectable input[type='radio']");
|
342
349
|
expect($radioLabels.eq(0).hasClass('selected')).toBe(false);
|
343
350
|
expect($radioLabels.eq(1).hasClass('selected')).toBe(false);
|
@@ -411,7 +418,14 @@ describe("selection-buttons", function () {
|
|
411
418
|
});
|
412
419
|
|
413
420
|
describe("At the point it is called", function () {
|
414
|
-
it("Should
|
421
|
+
it("Should mark checkboxes with the selection-button-checkbox class", function () {
|
422
|
+
buttonsInstance = new GOVUK.SelectionButtons("label.selectable input[type='checkbox']");
|
423
|
+
expect($checkboxLabels.eq(0).hasClass('selection-button-checkbox')).toBe(true);
|
424
|
+
expect($checkboxLabels.eq(1).hasClass('selection-button-checkbox')).toBe(true);
|
425
|
+
expect($checkboxLabels.eq(2).hasClass('selection-button-checkbox')).toBe(true);
|
426
|
+
});
|
427
|
+
|
428
|
+
it("Should not add a selected class if no checkboxes are checked", function () {
|
415
429
|
buttonsInstance = new GOVUK.SelectionButtons("label.selectable input[type='checkbox']");
|
416
430
|
expect($checkboxLabels.eq(0).hasClass('selected')).toBe(false);
|
417
431
|
expect($checkboxLabels.eq(1).hasClass('selected')).toBe(false);
|
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.
|
4
|
+
version: 4.17.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-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|