govuk-design-system-rails 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8931fd11b32ebb5fd301faf6ebcd4239742f9ad71c345e2832e9b2b831eecde4
4
- data.tar.gz: cae854677542d88eff4f8e2a85f5b587fa4aa5df8cf08558986aad22c47f60ca
3
+ metadata.gz: 9d9c752c65f527e2c23a15a9955ab438f2d422581debc5ffe196af752af35ae8
4
+ data.tar.gz: eea66bc7582da74d5b46165644293bc011d4c7cc142a9b19ac02aad828b19059
5
5
  SHA512:
6
- metadata.gz: e78d4f80e01aff7f8a075826b6b30c141be3a0d93651890fc69f72695dbb9f5e04a844982c951dc3e3aebea371825c7c9720dfb6bd6ddafab315e53a25d514bd
7
- data.tar.gz: 9e5b9f215ed15056e82bd8f2ed9db6b6a95df2c611bfd233f2f704146ef5686ff68780366630829686a22a7ebb70a4f5e4713311a4062e33eee746e51cfd47e5
6
+ metadata.gz: 821f93c096c7c7dd5d334ae98a2184285a9cc33ba90c2cabb62deed84267fdb57894febceb0e3a59599fe707b28ae1499feb44a8251c55d5e1760df7208534a8
7
+ data.tar.gz: a845dbed683c15887574fb8ec6ac24714b8a11afa07b09d06eb6171352b826fa724a8dc590c2b7f70f88d68f79b830feb7964a885ae6455b36ed80eb8d76b324
data/README.md CHANGED
@@ -14,7 +14,7 @@ You **must** include the [govuk-frontend](https://github.com/alphagov/govuk-fron
14
14
 
15
15
  | This gem's version | Compatible with `govuk-frontend` version |
16
16
  |--------------------| --- |
17
- | 0.10.2 | 4.3.1 |
17
+ | 0.9.7 | 4.3.1 |
18
18
  | 0.9.0 | 4.1.0 |
19
19
  | 0.8.2 | 3.14.0 |
20
20
 
@@ -96,10 +96,11 @@
96
96
  </svg>
97
97
  </button>
98
98
  <% end %>
99
+
99
100
  <script nonce="true">
100
- //<![CDATA[
101
- window.callAutocompleteWhenReady(<%= local_assigns[:id].to_json %>, { showAllValues: <%= local_assigns[:show_all_values].to_json %> });
102
- //]]>
101
+ // <![CDATA[
102
+ window.callAutocompleteWhenReady(<%= local_assigns[:id].to_json.html_safe %>, { showAllValues: <%= local_assigns[:show_all_values].to_json.html_safe %> });
103
+ // ]]>
103
104
  </script>
104
105
  <% else %>
105
106
  <%= select %>
@@ -2,7 +2,7 @@ $LOAD_PATH.push File.expand_path("lib", __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "govuk-design-system-rails"
5
- s.version = "0.10.2"
5
+ s.version = "0.10.3"
6
6
  s.authors = %w[govuk-ruby]
7
7
  s.summary = "An implementation of the govuk-frontend macros in Ruby on Rails"
8
8
  s.homepage = "https://github.com/govuk-ruby/govuk-design-system-rails"
@@ -81,5 +81,56 @@ RSpec.describe GovukDesignSystem::SelectHelper, type: :helper do
81
81
  </div>
82
82
  HTML
83
83
  end
84
+
85
+ it "returns the correct HTML when the select element is an autocomplete element" do
86
+ html = helper.govukSelect({
87
+ id: "sort",
88
+ name: "sort",
89
+ label: {
90
+ text: "Sort by"
91
+ },
92
+ items: [
93
+ {
94
+ value: "published",
95
+ text: "Recently published"
96
+ },
97
+ {
98
+ value: "updated",
99
+ text: "Recently updated",
100
+ selected: true
101
+ },
102
+ {
103
+ value: "views",
104
+ text: "Most views"
105
+ },
106
+ {
107
+ value: "comments",
108
+ text: "Most comments"
109
+ }
110
+ ],
111
+ is_autocomplete: true
112
+ })
113
+
114
+ expect(html).to match_html(<<~HTML)
115
+ <div class="govuk-form-group">
116
+ <label class="govuk-label" for="sort">
117
+ Sort by
118
+ </label>
119
+ <div class="">
120
+ <select class="govuk-select" id="sort" name="sort">
121
+ <option value="published">Recently published</option>
122
+ <option value="updated" selected="selected">Recently updated</option>
123
+ <option value="views">Most views</option>
124
+ <option value="comments">Most comments</option>
125
+ </select>
126
+ </div>
127
+ <script nonce="true">
128
+ // <![CDATA[
129
+ window.callAutocompleteWhenReady("sort", { showAllValues: null });
130
+ // ]]>
131
+ </script>
132
+ </div>
133
+ HTML
134
+ end
84
135
  end
85
136
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-design-system-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - govuk-ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compare-xml