govuk_frontend_toolkit 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
1
  language: node_js
2
2
  node_js:
3
3
  - "0.10"
4
+ rvm:
5
+ - 2.1.0
6
+ before_install:
7
+ - gem install sass
@@ -1,5 +1,31 @@
1
1
  module.exports = function(grunt) {
2
+ var allSassFiles = [];
3
+
4
+ var path = require('path');
5
+
6
+ grunt.file.recurse(
7
+ "./stylesheets/",
8
+ function(abspath, rootdir, subdir, filename) {
9
+ if(typeof subdir !== 'undefined'){
10
+ var relpath = subdir + '/' + filename;
11
+ } else {
12
+ var relpath = filename;
13
+ }
14
+ if (filename.match(/\.scss/)) {
15
+ allSassFiles.push("@import '" + relpath + "';");
16
+ }
17
+ }
18
+ );
19
+
20
+ grunt.file.write(
21
+ "./spec/stylesheets/test.scss",
22
+ allSassFiles.join("\n")
23
+ );
24
+
2
25
  grunt.initConfig({
26
+ clean: {
27
+ sass: ["spec/stylesheets/test*css"]
28
+ },
3
29
  jasmine: {
4
30
  javascripts: {
5
31
  src: [
@@ -11,9 +37,24 @@ module.exports = function(grunt) {
11
37
  helpers: 'spec/unit/*Helper.js'
12
38
  }
13
39
  }
40
+ },
41
+ sass: {
42
+ development: {
43
+ files: {
44
+ './spec/stylesheets/test-out.css': './spec/stylesheets/test.scss'
45
+ },
46
+ options: {
47
+ loadPath: [
48
+ './stylesheets'
49
+ ],
50
+ style: 'nested',
51
+ }
52
+ },
14
53
  }
15
54
  });
55
+ grunt.loadNpmTasks('grunt-contrib-clean');
16
56
  grunt.loadNpmTasks('grunt-contrib-jasmine');
17
- grunt.registerTask('test', ['jasmine']);
57
+ grunt.loadNpmTasks('grunt-contrib-sass');
58
+ grunt.registerTask('test', ['sass', 'clean', 'jasmine']);
18
59
  grunt.registerTask('default', ['test']);
19
60
  };
data/app/assets/README.md CHANGED
@@ -21,6 +21,14 @@ follow the [installation instructions][toolkit_gem_github_readme].
21
21
  [toolkit_npm_github]: https://github.com/alphagov/govuk_frontend_toolkit_npm
22
22
  [toolkit_npm]: https://npmjs.org/package/govuk_frontend_toolkit
23
23
 
24
+ ### Composer
25
+
26
+ [govuk_frontend_toolkit_composer][toolkit_composer_github] is an composer package that can be
27
+ [added to your composer.json][toolkit_composer_github_usage]
28
+
29
+ [toolkit_composer_github]: https://github.com/PurpleBooth/govuk_frontend_toolkit_composer
30
+ [toolkit_composer_github_usage]: https://github.com/PurpleBooth/govuk_frontend_toolkit_composer#installing
31
+
24
32
  ### Other projects
25
33
 
26
34
  You can include the toolkit as a [git submodule][].
@@ -55,22 +55,20 @@
55
55
  this.focusEvents = 'focus blur';
56
56
  };
57
57
  RadioButtons.prototype.getSelections = function () {
58
- var selectionEventHandler = this.markSelected.bind(this),
59
- selections = {};
58
+ var selectionEventHandler = this.markSelected.bind(this);
60
59
 
60
+ this.selections = {};
61
61
  $.each(this.$elms, function (index, elm) {
62
62
  var $elm = $(elm),
63
63
  radioName = $elm.attr('name');
64
64
 
65
- if (typeof selections[radioName] === 'undefined') {
66
- selections[radioName] = false;
65
+ if (typeof this.selections[radioName] === 'undefined') {
66
+ this.selections[radioName] = false;
67
67
  }
68
68
  if ($elm.is(':checked')) {
69
69
  selectionEventHandler($elm);
70
- selections[radioName] = $elm;
71
70
  }
72
- });
73
- this.selections = selections;
71
+ }.bind(this));
74
72
  };
75
73
  RadioButtons.prototype.bindEvents = function () {
76
74
  BaseButtons.prototype.bindEvents.call(this);
@@ -5,7 +5,9 @@
5
5
  "devDependencies": {
6
6
  "grunt": "~0.4.2",
7
7
  "grunt-cli": "0.1.11",
8
+ "grunt-contrib-clean":"~0.6.0",
8
9
  "grunt-contrib-jasmine": "~0.5.2",
10
+ "grunt-contrib-sass": "0.7.4",
9
11
  "jquery-browser": "~1.7.2-3"
10
12
  },
11
13
  "scripts": {
@@ -5,11 +5,13 @@ var manifest = {
5
5
  '../../javascripts/govuk/multivariate-test.js',
6
6
  '../../javascripts/govuk/primary-links.js',
7
7
  '../../javascripts/govuk/stick-at-top-when-scrolling.js',
8
- '../../javascripts/govuk/stop-scrolling-at-footer.js'
8
+ '../../javascripts/govuk/stop-scrolling-at-footer.js',
9
+ '../../javascripts/govuk/selection-buttons.js'
9
10
  ],
10
11
  test : [
11
12
  '../unit/MultivariateTestSpec.js',
12
13
  '../unit/PrimaryLinksSpec.js',
13
- '../unit/StickAtTopWhenScrollingSpec.js'
14
+ '../unit/StickAtTopWhenScrollingSpec.js',
15
+ '../unit/SelectionButtonSpec.js'
14
16
  ]
15
17
  };
@@ -69,14 +69,16 @@ describe("selection-buttons", function () {
69
69
  describe("getSelections method", function () {
70
70
  it("Should mark the label of any checked radios as selected", function () {
71
71
  var radioButtonsMock = {
72
- 'markSelected' : function () {},
73
- '$elms' : $radioButtons
72
+ 'markSelected' : GOVUK.RadioButtons.prototype.markSelected,
73
+ '$elms' : $radioButtons,
74
+ 'selectedClass' : 'selected'
74
75
  };
75
76
 
76
77
  $radioButtons.eq(0).attr('checked', true);
77
- spyOn(radioButtonsMock, 'markSelected');
78
+ spyOn(radioButtonsMock, 'markSelected').andCallThrough();
78
79
  GOVUK.RadioButtons.prototype.getSelections.call(radioButtonsMock);
79
80
  expect(radioButtonsMock.markSelected).toHaveBeenCalled();
81
+ expect($radioButtons.eq(0).parent('label').hasClass('selected')).toBe(true);
80
82
  });
81
83
  });
82
84
 
@@ -17,204 +17,113 @@
17
17
 
18
18
  $is-print: false !default;
19
19
 
20
- @mixin core-80($line-height: (80 / 80), $line-height-640: (55 / 53), $tabular-numbers: false) {
20
+ @mixin _core-font-generator($font-size: 19px, $font-size-640: 16px, $font-size-print: 14pt, $line-height: (25 / 19), $line-height-640: (20 / 16), $tabular-numbers: false, $font-weight: 400) {
21
21
  @if $tabular-numbers == true {
22
22
  font-family: $NTA-Light-Tabular;
23
23
  } @else {
24
24
  font-family: $NTA-Light;
25
25
  }
26
26
  @if $is-print == false {
27
- font-size: 80px;
27
+ font-size: $font-size;
28
28
  } @else {
29
- font-size: 28pt;
29
+ font-size: $font-size-print;
30
30
  }
31
31
  line-height: $line-height;
32
- font-weight: 400;
32
+ font-weight: $font-weight;
33
33
  text-transform: none;
34
34
  @media (max-width: 640px) {
35
- font-size: 53px;
35
+ font-size: $font-size-640;
36
36
  line-height: $line-height-640;
37
37
  }
38
38
  }
39
39
 
40
- @mixin core-48($line-height: (50 / 48), $line-height-640: (35 / 32), $tabular-numbers: false) {
41
- @if $tabular-numbers == true {
42
- font-family: $NTA-Light-Tabular;
43
- } @else {
44
- font-family: $NTA-Light;
45
- }
46
- @if $is-print == false {
47
- font-size: 48px;
48
- } @else {
49
- font-size: 18pt;
50
- }
51
- line-height: $line-height;
52
- font-weight: 400;
53
- text-transform: none;
54
- @media (max-width: 640px) {
55
- font-size: 32px;
56
- line-height: $line-height-640;
57
- }
40
+
41
+ @mixin core-80($line-height: (80 / 80), $line-height-640: (55 / 53), $tabular-numbers: false, $font-weight: 400) {
42
+ $font-size: 80px;
43
+ $font-size-640: 53px;
44
+ $font-size-print: 28pt;
45
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
58
46
  }
59
47
 
60
- @mixin core-36($line-height: (40 / 36), $line-height-640: (25 / 24), $tabular-numbers: false) {
61
- @if $tabular-numbers == true {
62
- font-family: $NTA-Light-Tabular;
63
- } @else {
64
- font-family: $NTA-Light;
65
- }
66
- @if $is-print == false {
67
- font-size: 36px;
68
- } @else {
69
- font-size: 18pt;
70
- }
71
- line-height: $line-height;
72
- font-weight: 400;
73
- text-transform: none;
74
- @media (max-width: 640px) {
75
- font-size: 24px;
76
- line-height: $line-height-640;
77
- }
48
+ @mixin core-48($line-height: (50 / 48), $line-height-640: (35 / 32), $tabular-numbers: false, $font-weight: 400) {
49
+ $font-size: 48px;
50
+ $font-size-640: 32px;
51
+ $font-size-print: 18pt;
52
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
78
53
  }
79
54
 
80
- @mixin core-27($line-height: (30 / 27), $line-height-640: (20 / 18), $tabular-numbers: false) {
81
- @if $tabular-numbers == true {
82
- font-family: $NTA-Light-Tabular;
83
- } @else {
84
- font-family: $NTA-Light;
85
- }
86
- @if $is-print == false {
87
- font-size: 27px;
88
- } @else {
89
- font-size: 16pt;
90
- }
91
- line-height: $line-height;
92
- font-weight: 400;
93
- text-transform: none;
94
- @media (max-width: 640px) {
95
- font-size: 18px;
96
- line-height: $line-height-640;
97
- }
55
+ @mixin core-36($line-height: (40 / 36), $line-height-640: (25 / 24), $tabular-numbers: false, $font-weight: 400) {
56
+ $font-size: 36px;
57
+ $font-size-640: 24px;
58
+ $font-size-print: 18pt;
59
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
98
60
  }
99
61
 
100
- @mixin core-24($line-height: (30 / 24), $line-height-640: (24 / 20), $tabular-numbers: false) {
101
- @if $tabular-numbers == true {
102
- font-family: $NTA-Light-Tabular;
103
- } @else {
104
- font-family: $NTA-Light;
105
- }
106
- @if $is-print == false {
107
- font-size: 24px;
108
- } @else {
109
- font-size: 16pt;
110
- }
111
- line-height: $line-height;
112
- font-weight: 400;
113
- text-transform: none;
114
- @media (max-width: 640px) {
115
- font-size: 20px;
116
- line-height: $line-height-640;
117
- }
62
+ @mixin core-27($line-height: (30 / 27), $line-height-640: (20 / 18), $tabular-numbers: false, $font-weight: 400) {
63
+ $font-size: 27px;
64
+ $font-size-640: 20px;
65
+ $font-size-print: 16pt;
66
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
118
67
  }
119
68
 
120
- @mixin core-19($line-height: (25 / 19), $line-height-640: (20 / 16), $tabular-numbers: false) {
121
- @if $tabular-numbers == true {
122
- font-family: $NTA-Light-Tabular;
123
- } @else {
124
- font-family: $NTA-Light;
125
- }
126
- @if $is-print == false {
127
- font-size: 19px;
128
- } @else {
129
- font-size: 14pt;
130
- }
131
- line-height: $line-height;
132
- font-weight: 400;
133
- text-transform: none;
134
- @media (max-width: 640px) {
135
- font-size: 16px;
136
- line-height: $line-height-640;
137
- }
69
+ @mixin core-24($line-height: (30 / 24), $line-height-640: (24 / 20), $tabular-numbers: false, $font-weight: 400) {
70
+ $font-size: 24px;
71
+ $font-size-640: 18px;
72
+ $font-size-print: 16pt;
73
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
138
74
  }
139
75
 
140
- @mixin core-16($line-height: (20 / 16), $line-height-640: (16 / 14), $tabular-numbers: false) {
141
- @if $tabular-numbers == true {
142
- font-family: $NTA-Light-Tabular;
143
- } @else {
144
- font-family: $NTA-Light;
145
- }
146
- @if $is-print == false {
147
- font-size: 16px;
148
- } @else {
149
- font-size: 12pt;
150
- }
151
- line-height: $line-height;
152
- font-weight: 300;
153
- text-transform: none;
154
- @media (max-width: 640px) {
155
- font-size: 14px;
156
- line-height: $line-height-640;
157
- }
76
+ @mixin core-19($line-height: (25 / 19), $line-height-640: (20 / 16), $tabular-numbers: false, $font-weight: 400) {
77
+ $font-size: 19px;
78
+ $font-size-640: 16px;
79
+ $font-size-print: 14pt;
80
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
158
81
  }
159
82
 
160
- @mixin core-14($line-height: (20 / 14), $line-height-640: (15 / 12), $tabular-numbers: false) {
161
- @if $tabular-numbers == true {
162
- font-family: $NTA-Light-Tabular;
163
- } @else {
164
- font-family: $NTA-Light;
165
- }
166
- @if $is-print == false {
167
- font-size: 14px;
168
- } @else {
169
- font-size: 11pt;
170
- }
171
- line-height: $line-height;
172
- font-weight: 400;
173
- text-transform: none;
174
- @media (max-width: 640px) {
175
- font-size: 12px;
176
- line-height: $line-height-640;
177
- }
83
+ @mixin core-16($line-height: (20 / 16), $line-height-640: (16 / 14), $tabular-numbers: false, $font-weight: 400) {
84
+ $font-size: 16px;
85
+ $font-size-640: 14px;
86
+ $font-size-print: 12pt;
87
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
88
+ }
89
+
90
+ @mixin core-14($line-height: (20 / 14), $line-height-640: (15 / 12), $tabular-numbers: false, $font-weight: 400) {
91
+ $font-size: 14px;
92
+ $font-size-640: 12px;
93
+ $font-size-print: 11pt;
94
+ @include _core-font-generator($font-size, $font-size-640, $font-size-print, $line-height, $line-height-640, $tabular-numbers, $font-weight);
178
95
  }
179
96
 
180
97
  @mixin bold-80($line-height: (80 / 80), $line-height-640: (55 / 53), $tabular-numbers: false) {
181
- @include core-80($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
182
- font-weight: 700;
98
+ @include core-80($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
183
99
  }
184
100
 
185
101
  @mixin bold-48($line-height: (50 / 48), $line-height-640: (35 / 32), $tabular-numbers: false) {
186
- @include core-48($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
187
- font-weight: 700;
102
+ @include core-48($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
188
103
  }
189
104
 
190
105
  @mixin bold-36($line-height: (40 / 36), $line-height-640: (25 / 24), $tabular-numbers: false) {
191
- @include core-36($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
192
- font-weight: 700;
106
+ @include core-36($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
193
107
  }
194
108
 
195
109
  @mixin bold-27($line-height: (30 / 27), $line-height-640: (20 / 18), $tabular-numbers: false) {
196
- @include core-27($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
197
- font-weight: 700;
110
+ @include core-27($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
198
111
  }
199
112
 
200
113
  @mixin bold-24($line-height: (30 / 24), $line-height-640: (24 / 20), $tabular-numbers: false) {
201
- @include core-24($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
202
- font-weight: 700;
114
+ @include core-24($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
203
115
  }
204
116
 
205
117
  @mixin bold-19($line-height: (25 / 19), $line-height-640: (20 / 16), $tabular-numbers: false) {
206
- @include core-19($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
207
- font-weight: 700;
118
+ @include core-19($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
208
119
  }
209
120
 
210
121
  @mixin bold-16($line-height: (20 / 16), $line-height-640: (16 / 14), $tabular-numbers: false) {
211
- @include core-16($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
212
- font-weight: 700;
122
+ @include core-16($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
213
123
  }
214
124
 
215
125
  @mixin bold-14($line-height: (20 / 14), $line-height-640: (15 / 12), $tabular-numbers: false) {
216
- @include core-14($line-height, $line-height-640, $tabular-numbers: $tabular-numbers);
217
- font-weight: 700;
126
+ @include core-14($line-height, $line-height-640, $tabular-numbers: $tabular-numbers, $font-weight: 700);
218
127
  }
219
128
 
220
129
  @mixin heading-80($tabular-numbers: false) {
@@ -1,3 +1,3 @@
1
1
  module GovUKFrontendToolkit
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
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: 1.5.0
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-30 00:00:00.000000000 Z
12
+ date: 2014-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &19233640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 3.1.0
24
+ version_requirements: *19233640
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: sass
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &19322160 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,44 +32,29 @@ dependencies:
37
32
  version: 3.2.0
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 3.2.0
35
+ version_requirements: *19322160
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: gem_publisher
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &19320800 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
- - - '='
41
+ - - =
52
42
  - !ruby/object:Gem::Version
53
43
  version: 1.3.1
54
44
  type: :development
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 1.3.1
46
+ version_requirements: *19320800
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: rake
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &19319600 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
- - - '='
52
+ - - =
68
53
  - !ruby/object:Gem::Version
69
54
  version: 0.9.2.2
70
55
  type: :development
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - '='
76
- - !ruby/object:Gem::Version
77
- version: 0.9.2.2
57
+ version_requirements: *19319600
78
58
  description:
79
59
  email: bradley.wright@digital.cabinet-office.gov.uk
80
60
  executables: []
@@ -233,7 +213,6 @@ files:
233
213
  - app/assets/javascripts/vendor/polyfills/bind.js
234
214
  - app/assets/jenkins.sh
235
215
  - app/assets/package.json
236
- - app/assets/spec/SelectionButtonSpec.js
237
216
  - app/assets/spec/manifest.js
238
217
  - app/assets/spec/support/LocalTestRunner.html
239
218
  - app/assets/spec/support/console-runner.js
@@ -241,6 +220,7 @@ files:
241
220
  - app/assets/spec/support/run_jasmine_test.js
242
221
  - app/assets/spec/unit/MultivariateTestSpec.js
243
222
  - app/assets/spec/unit/PrimaryLinksSpec.js
223
+ - app/assets/spec/unit/SelectionButtonSpec.js
244
224
  - app/assets/spec/unit/StickAtTopWhenScrollingSpec.js
245
225
  - app/assets/stylesheets/.gitkeep
246
226
  - app/assets/stylesheets/_colours.scss
@@ -272,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
252
  version: '0'
273
253
  segments:
274
254
  - 0
275
- hash: 1799776564228403607
255
+ hash: -4285435164895981672
276
256
  required_rubygems_version: !ruby/object:Gem::Requirement
277
257
  none: false
278
258
  requirements:
@@ -281,10 +261,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
261
  version: '0'
282
262
  segments:
283
263
  - 0
284
- hash: 1799776564228403607
264
+ hash: -4285435164895981672
285
265
  requirements: []
286
266
  rubyforge_project:
287
- rubygems_version: 1.8.23
267
+ rubygems_version: 1.8.11
288
268
  signing_key:
289
269
  specification_version: 3
290
270
  summary: Tools for building frontend applications