From fe227d89a551de25921bc6d67fd654563e64e29b Mon Sep 17 00:00:00 2001 From: Romaric Date: Thu, 29 Sep 2022 18:27:10 +0100 Subject: [PATCH] Update JSDoc --- src/govuk/common.mjs | 3 ++- .../character-count/character-count.mjs | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/govuk/common.mjs b/src/govuk/common.mjs index 93afeee9ea..21c94c5479 100644 --- a/src/govuk/common.mjs +++ b/src/govuk/common.mjs @@ -188,9 +188,10 @@ export function normaliseDataset (dataset) { } /** - * Returns the value of the `lang` attribute closest to the given element (including itself) + * Returns the value of the given attribute closest to the given element (including itself) * * @param {HTMLElement} $element - The element to start walking the DOM tree up + * @param {String} attributeName - The name of the attribute * @returns {String|undefined} */ export function closestAttributeValue ($element, attributeName) { diff --git a/src/govuk/components/character-count/character-count.mjs b/src/govuk/components/character-count/character-count.mjs index 2210071d1f..7c447738db 100644 --- a/src/govuk/components/character-count/character-count.mjs +++ b/src/govuk/components/character-count/character-count.mjs @@ -24,6 +24,27 @@ import I18n from '../../i18n.mjs' * @param {Number} [config.threshold=0] - The percentage value of the limit at * which point the count message is displayed. If this attribute is set, the * count message will be hidden by default. + * @param {Object} [config.i18n] + * @param {String} [config.i18n.charactersUnderLimitOne="You have %{count} character remaining"] + * Message notifying users they're 1 character under the limit + * @param {String} [config.i18n.charactersUnderLimitOther="You have %{count} characters remaining"] + * Message notifying users they're any number of characters under the limit + * @param {String} [config.i18n.charactersAtLimit="You have no characters remaining"] + * Message notifying users they've reached the limit number of characters + * @param {String} [config.i18n.charactersOverLimitOne="You have %{count} character too many"] + * Message notifying users they're 1 character over the limit + * @param {String} [config.i18n.charactersOverLimitOther="You have %{count} characters too many"] + * Message notifying users they're any number of characters over the limit + * @param {String} [config.i18n.wordsUnderLimitOne="You have %{count} word remaining"] + * Message notifying users they're 1 word under the limit + * @param {String} [config.i18n.wordsUnderLimitOther="You have %{count} words remaining"] + * Message notifying users they're any number of words under the limit + * @param {String} [config.i18n.wordsAtLimit="You have no words remaining"] + * Message notifying users they've reached the limit number of words + * @param {String} [config.i18n.wordsOverLimitOne="You have %{count} word too many"] + * Message notifying users they're 1 word over the limit + * @param {String} [config.i18n.wordsOverLimitOther="You have %{count} words too many"] + * Message notifying users they're any number of words over the limit */ function CharacterCount ($module, config) { if (!$module) {