Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove min and max attributes from text type inputs #3161

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/components/autosuggest/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"accessiblePlaceholder": params.input.accessiblePlaceholder,
"name": params.input.name,
"autosuggestResults": autosuggestResults,
"min": params.input.min,
"max": params.input.max,
"minLength": params.input.minLength,
"maxLength": params.input.maxLength,
"prefix": params.input.prefix,
Expand Down
8 changes: 2 additions & 6 deletions src/components/autosuggest/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ describe('macro: autosuggest', () => {
},
mutuallyExclusive: null,
accessiblePlaceholder: true,
name: 'country-of-birth-test',
min: 1,
max: 10,
name: 'test-params',
minLength: 1,
maxLength: 10,
prefix: {
Expand Down Expand Up @@ -210,10 +208,8 @@ describe('macro: autosuggest', () => {
expect(inputSpy.occurrences[0]).toHaveProperty('error.text', 'An error occurred.');
expect(inputSpy.occurrences[0]).toHaveProperty('mutuallyExclusive', null);
expect(inputSpy.occurrences[0]).toHaveProperty('accessiblePlaceholder', true);
expect(inputSpy.occurrences[0]).toHaveProperty('name', 'country-of-birth-test');
expect(inputSpy.occurrences[0]).toHaveProperty('name', 'test-params');
expect(typeof inputSpy.occurrences[0].autosuggestResults).toBe('string');
expect(inputSpy.occurrences[0]).toHaveProperty('min', 1);
expect(inputSpy.occurrences[0]).toHaveProperty('max', 10);
expect(inputSpy.occurrences[0]).toHaveProperty('minLength', 1);
expect(inputSpy.occurrences[0]).toHaveProperty('maxLength', 10);
expect(inputSpy.occurrences[0]).toHaveProperty('prefix.title', 'Great British Pounds');
Expand Down
6 changes: 0 additions & 6 deletions src/components/date-input/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
"name": params.day.name,
"classes": (" ons-input--error" if (params.error and params.day.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
"width": "2",
"min": 1,
"max": 31,
"maxLength": 2,
"attributes": params.day.attributes,
"label": {
Expand All @@ -46,8 +44,6 @@
"name": params.month.name,
"classes": (" ons-input--error" if (params.error and params.month.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
"width": "2",
"min": 1,
"max": 12,
"maxLength": 2,
"attributes": params.month.attributes,
"label": {
Expand All @@ -67,8 +63,6 @@
"name": params.year.name,
"classes": (" ons-input--error" if (params.error and params.year.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
"width": "4",
"min": 1000,
"max": 3000,
"maxLength": 4,
"attributes": params.year.attributes,
"label": {
Expand Down
8 changes: 0 additions & 8 deletions src/components/date-input/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ describe('macro: date input', () => {
type: 'number',
name: 'day',
width: '2',
min: 1,
max: 31,
maxLength: 2,
classes: '',
error: '',
Expand All @@ -201,8 +199,6 @@ describe('macro: date input', () => {
type: 'number',
name: 'month',
width: '2',
min: 1,
max: 12,
maxLength: 2,
classes: '',
error: '',
Expand All @@ -229,8 +225,6 @@ describe('macro: date input', () => {
type: 'number',
name: 'year',
width: '4',
min: 1000,
max: 3000,
maxLength: 4,
classes: '',
error: '',
Expand Down Expand Up @@ -349,8 +343,6 @@ describe('macro: date input', () => {
type: 'number',
name: 'year',
width: '4',
min: 1000,
max: 3000,
maxLength: 4,
classes: '',
label: {
Expand Down
62 changes: 31 additions & 31 deletions src/components/input/_macro-options.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/components/input/example-input-number.njk
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{% from "components/input/_macro.njk" import onsInput %}

{{
onsInput({
"id": "number-example-input",
"type": "number",
"width": "2",
"autocomplete": "off",
"attributes": {
"min": 0
},
"label": {
"text": "Number of bedrooms"
}
Expand Down
3 changes: 0 additions & 3 deletions src/components/input/example-input-numeric-values.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"type": "number",
"width": "2",
"autocomplete": "off",
"attributes": {
"min": 0
},
"label": {
"text": "Number of bedrooms"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"dontWrap": true,
"type": "number",
"width": "4",
"attributes": {
"min": 0
},
"label": {
"text": "Gross annual income"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_PARAMS = {
text: 'Years',
id: 'address-duration-years-suffix',
},
attributes: {
min: 0,
max: 100,
},
},
field2: {
id: 'address-duration-months',
Expand All @@ -25,10 +21,6 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_PARAMS = {
text: 'Months',
id: 'address-duration-months-suffix',
},
attributes: {
min: 0,
max: 11,
},
},
mutuallyExclusive: {
or: 'Or',
Expand Down Expand Up @@ -59,10 +51,6 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_SINGLE_PARAMS = {
text: 'Years',
id: 'address-duration-years-suffix',
},
attributes: {
min: 0,
max: 100,
},
},
mutuallyExclusive: {
or: 'Or',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_NUMBER_INPUT_PARAMS = {
type: 'number',
legend: 'What is your annual income before tax in 2018/19?',
width: '5',
attributes: {
min: 0,
},
label: {
text: 'Gross annual income',
},
Expand Down
Loading