Skip to content

Commit

Permalink
Addressed PR comment and update visual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
admilne committed Oct 25, 2024
1 parent 0c7a9d2 commit d8a8468
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/checkboxes/_checkbox-macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"name": params.other.name,
"value": params.other.value,
"label": {
"id": params.other.id + "-label",
"text": params.other.label.text,
"description": params.other.label.description,
"classes": 'ons-u-fw-n'
Expand Down
1 change: 1 addition & 0 deletions src/components/checkboxes/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ describe('macro: checkboxes', () => {
it('renders the text area with expected parameters', () => {
const $ = cheerio.load(renderComponent('checkboxes', EXAMPLE_CHECKBOX_ITEM_CHECKBOXES_WITH_TEXTAREA));
expect($('.ons-input--textarea').attr('name')).toBe('other answer');
expect($('.ons-input--textarea').attr('maxlength')).toBe('300');
expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% from "components/question/_macro.njk" import onsQuestion %}
{% from "components/checkboxes/_macro.njk" import onsCheckboxes %}

{%
call onsQuestion({
"title": "Do you have any dietary requirements?",
"legendIsQuestionTitle": true,
"classes": "ons-u-mt-no"
})
%}
{{
onsCheckboxes({
"checkboxesLabel": "Select all that apply",
"dontWrap": true,
"checkboxes": [
{
"id": "gluten-free-example-checkbox-with-revealed-text-area",
"label": {
"text": "Gluten free"
},
"value": "gluten-free"
},
{
"id": "lactose-intolerant-example-checkbox-with-revealed-text-area",
"label": {
"text": "Lactose intolerant"
},
"value": "lactose-intolerant"
},
{
"id": "vegan-example-checkbox-with-revealed-text-area",
"label": {
"text": "Vegan"
},
"value": "vegan"
},
{
"id": "vegetarian-example-checkbox-with-revealed-text-area",
"label": {
"text": "Vegetarian"
},
"value": "vegetarian"
},
{
"id": "other-checkbox-with-revealed-text-area",
"label": {
"text": "Other"
},
"value": "other",
"checked": true,
"other": {
"otherType": "textarea",
"id": "other-textbox-example-checkbox-with-revealed-text-area",
"name": "other-answer",
"label": {
"text": "Provide more details"
},
"charCheckLimit": {
"limit": 200,
"charCountSingular": "You have {x} character remaining",
"charCountPlural": "You have {x} characters remaining"
}
}
}
]
})
}}
{% endcall %}
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@
"dontWrap": true,
"checkboxes": [
{
"id": "gluten-free-example-checkbox-with-revealed-text-input",
"id": "gluten-free-example-checkbox-with-revealed-text-area",
"label": {
"text": "Gluten free"
},
"value": "gluten-free"
},
{
"id": "lactose-intolerant-example-checkbox-with-revealed-text-input",
"id": "lactose-intolerant-example-checkbox-with-revealed-text-area",
"label": {
"text": "Lactose intolerant"
},
"value": "lactose-intolerant"
},
{
"id": "vegan-example-checkbox-with-revealed-text-input",
"id": "vegan-example-checkbox-with-revealed-text-area",
"label": {
"text": "Vegan"
},
"value": "vegan"
},
{
"id": "vegetarian-example-checkbox-with-revealed-text-input",
"id": "vegetarian-example-checkbox-with-revealed-text-area",
"label": {
"text": "Vegetarian"
},
"value": "vegetarian"
},
{
"id": "other-checkbox-with-revealed-text-input",
"id": "other-checkbox-with-revealed-text-area",
"label": {
"text": "Other"
},
Expand All @@ -55,7 +55,7 @@
"text": "Provide more details"
},
"charCheckLimit": {
"limit": 400,
"limit": 200,
"charCountSingular": "You have {x} character remaining",
"charCountPlural": "You have {x} characters remaining"
}
Expand Down

0 comments on commit d8a8468

Please sign in to comment.