-
Notifications
You must be signed in to change notification settings - Fork 334
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
Allow CharacterCount to receive configuration via JavaScript #2883
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-2883
September 27, 2022 17:06
Inactive
for consistency with other components
- explicitely shows the option in the defaultConfig - shortcircuit useless computations if it's not set
romaricpascal
force-pushed
the
character-count-config
branch
from
September 27, 2022 17:08
c63d712
to
5813b12
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-2883
September 27, 2022 17:09
Inactive
Thanks to the introduction of the dataset polyfill for configuration/i18n, we can now use element.dataset directly
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-2883
September 28, 2022 13:43
Inactive
36degrees
reviewed
Sep 29, 2022
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-2883
September 29, 2022 10:59
Inactive
36degrees
approved these changes
Sep 29, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The configuration spree continues! CharacterCount needs its own little behaviour when it comes to merging the data attributes and JavaScript configuration:
maxwords
takes precedence overmaxlength
. This means we need to clear some of the JavaScript configuration if any of these options are set through data attributes to avoid amaxwords
set in JavaScript always winning against adata-maxlength
attribute:Commits should paint a step-by-step picture of how things happened.
Keeping this as draft for now as I'm on the fence of whether to rework the tests as unit tests checking that the right values end up inOpening to review with puppeteer tests so further work on internationalisation can be carried on. Tests will likely be reworked soon when/if creating a base component in 5.0.this.config
rather than run in a browser.Closes #2837