@defra/lis-infra-ui-services 0.25.0 → 0.26.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/lis-infra-ui-services",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "UI-Services shared definitions for the livestock taxonomy topology.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -170,4 +170,20 @@ describe('searchForm()', () => {
170
170
  'Recent changes such as new registrations may take up to 24 hours to appear in your list.'
171
171
  )
172
172
  })
173
+
174
+ test('renders maxlength on the search input when given', () => {
175
+ // Act
176
+ const html = render({ label: 'Search', maxlength: 50 })
177
+
178
+ // Assert
179
+ expect(html).toContain('maxlength="50"')
180
+ })
181
+
182
+ test('renders no maxlength attribute when not given', () => {
183
+ // Act
184
+ const html = render({ label: 'Search' })
185
+
186
+ // Assert
187
+ expect(html).not.toContain('maxlength')
188
+ })
173
189
  })
@@ -23,6 +23,7 @@
23
23
  name="{{ params.name or 'search' }}"
24
24
  value="{{ params.value }}"
25
25
  {% if params.hint %}aria-describedby="{{ id }}-hint"{% endif %}
26
+ {% if params.maxlength %}maxlength="{{ params.maxlength }}"{% endif %}
26
27
  >
27
28
  <div class="lis-search-form__submit-wrapper">
28
29
  <button class="lis-search-form__submit" type="submit">