Skip to content

Commit

Permalink
fix: textarea script registration
Browse files Browse the repository at this point in the history
  • Loading branch information
rowellx68 committed May 29, 2024
1 parent e77f7c5 commit 7ec0728
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ exports[`should render the Details component 1`] = `
<details
class="nhsuk-details"
data-testid="details"
id="nhsuk-details0"
nhsuk-polyfilled="true"
>
<summary
aria-controls="nhsuk-details__text0"
aria-expanded="false"
class="nhsuk-details__summary"
data-testid="details-summary"
role="button"
tabindex="0"
>
<span
class="nhsuk-details__summary-text"
Expand All @@ -17,8 +23,11 @@ exports[`should render the Details component 1`] = `
</span>
</summary>
<div
aria-hidden="true"
class="nhsuk-details__text"
data-testid="details-text"
id="nhsuk-details__text0"
style="display: none;"
>
<p>
An NHS number is a 10 digit number, like 485 777 3456.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ exports[`should render the Expander Group component 1`] = `
>
<details
class="nhsuk-details nhsuk-expander"
id="nhsuk-details0"
nhsuk-polyfilled="true"
>
<summary
aria-controls="nhsuk-details__text0"
aria-expanded="false"
class="nhsuk-details__summary"
role="button"
tabindex="0"
>
<span
class="nhsuk-details__summary-text"
Expand All @@ -18,7 +24,10 @@ exports[`should render the Expander Group component 1`] = `
</span>
</summary>
<div
aria-hidden="true"
class="nhsuk-details__text"
id="nhsuk-details__text0"
style="display: none;"
>
<p>
Testing your blood at home is quick and easy, although it can be uncomfortable. It does get better.
Expand All @@ -44,9 +53,15 @@ exports[`should render the Expander Group component 1`] = `
</details>
<details
class="nhsuk-details nhsuk-expander"
id="nhsuk-details1"
nhsuk-polyfilled="true"
>
<summary
aria-controls="nhsuk-details__text1"
aria-expanded="false"
class="nhsuk-details__summary"
role="button"
tabindex="0"
>
<span
class="nhsuk-details__summary-text"
Expand All @@ -55,7 +70,10 @@ exports[`should render the Expander Group component 1`] = `
</span>
</summary>
<div
aria-hidden="true"
class="nhsuk-details__text"
id="nhsuk-details__text1"
style="display: none;"
>
<p>
Try to check your blood:
Expand Down Expand Up @@ -84,9 +102,15 @@ exports[`should render the Expander component 1`] = `
<div>
<details
class="nhsuk-details nhsuk-expander"
id="nhsuk-details0"
nhsuk-polyfilled="true"
>
<summary
aria-controls="nhsuk-details__text0"
aria-expanded="false"
class="nhsuk-details__summary"
role="button"
tabindex="0"
>
<span
class="nhsuk-details__summary-text"
Expand All @@ -95,7 +119,10 @@ exports[`should render the Expander component 1`] = `
</span>
</summary>
<div
aria-hidden="true"
class="nhsuk-details__text"
id="nhsuk-details__text0"
style="display: none;"
>
<p>
You can see your GP records by:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,78 @@ exports[`should render the Tabs component 1`] = `
</h2>
<ul
class="nhsuk-tabs__list"
role="tablist"
>
<li
class="nhsuk-tabs__list-item"
class="nhsuk-tabs__list-item nhsuk-tabs__list-item--selected"
role="presentation"
>
<a
aria-controls="past-day"
aria-selected="true"
class="nhsuk-tabs__tab"
href="#past-day"
id="tab_past-day"
role="tab"
tabindex="0"
>
Past day
</a>
</li>
<li
class="nhsuk-tabs__list-item"
role="presentation"
>
<a
aria-controls="past-week"
aria-selected="false"
class="nhsuk-tabs__tab"
href="#past-week"
id="tab_past-week"
role="tab"
tabindex="-1"
>
Past week
</a>
</li>
<li
class="nhsuk-tabs__list-item"
role="presentation"
>
<a
aria-controls="past-month"
aria-selected="false"
class="nhsuk-tabs__tab"
href="#past-month"
id="tab_past-month"
role="tab"
tabindex="-1"
>
Past month
</a>
</li>
<li
class="nhsuk-tabs__list-item"
role="presentation"
>
<a
aria-controls="past-year"
aria-selected="false"
class="nhsuk-tabs__tab"
href="#past-year"
id="tab_past-year"
role="tab"
tabindex="-1"
>
Past year
</a>
</li>
</ul>
<div
aria-labelledby="tab_past-day"
class="nhsuk-tabs__panel"
id="past-day"
role="tabpanel"
>
<h2>
Past day
Expand All @@ -67,8 +94,10 @@ exports[`should render the Tabs component 1`] = `
</p>
</div>
<div
class="nhsuk-tabs__panel"
aria-labelledby="tab_past-week"
class="nhsuk-tabs__panel nhsuk-tabs__panel--hidden"
id="past-week"
role="tabpanel"
>
<h2>
Past week
Expand All @@ -78,8 +107,10 @@ exports[`should render the Tabs component 1`] = `
</p>
</div>
<div
class="nhsuk-tabs__panel"
aria-labelledby="tab_past-month"
class="nhsuk-tabs__panel nhsuk-tabs__panel--hidden"
id="past-month"
role="tabpanel"
>
<h2>
Past month
Expand All @@ -89,8 +120,10 @@ exports[`should render the Tabs component 1`] = `
</p>
</div>
<div
class="nhsuk-tabs__panel"
aria-labelledby="tab_past-year"
class="nhsuk-tabs__panel nhsuk-tabs__panel--hidden"
id="past-year"
role="tabpanel"
>
<h2>
Past year
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,14 @@ const Textarea = factory<TextareaFactory>(
return;
}

const parent = internalRef.current.closest(
'.nhsuk-character-count',
)?.parentElement;
const parent = internalRef.current.parentElement;

if (!parent) {
return;
}

initTextarea({ scope: parent as any });
});
}, [internalRef, characterCount]);

return (
<Base<any> {...baseProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ exports[`should render the Header component 1`] = `
/>
</svg>
</button>
<ul
class="nhsuk-header__drop-down nhsuk-header__drop-down--hidden"
/>
</li>
</ul>
</nav>
Expand Down Expand Up @@ -457,6 +460,9 @@ exports[`should render the Header component with a service name 1`] = `
/>
</svg>
</button>
<ul
class="nhsuk-header__drop-down nhsuk-header__drop-down--hidden"
/>
</li>
</ul>
</nav>
Expand Down Expand Up @@ -682,6 +688,9 @@ exports[`should render the Header component with an organisation 1`] = `
/>
</svg>
</button>
<ul
class="nhsuk-header__drop-down nhsuk-header__drop-down--hidden"
/>
</li>
</ul>
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`should render the SkipLink component 1`] = `
<a
class="nhsuk-skip-link"
href="#maincontent"
tabindex="0"
>
Skip to main content
</a>
Expand Down

0 comments on commit 7ec0728

Please sign in to comment.