-
Notifications
You must be signed in to change notification settings - Fork 323
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
Throw errors during Tabs initialisation if key HTML elements are missing #4263
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 1377822 |
148460c
to
acd09cd
Compare
acd09cd
to
38d951f
Compare
'.govuk-tabs__list-item' | ||
) | ||
|
||
if (!this.$tabs || !$tabList || !$tabListItems) { |
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.
🙌
6111f13
to
0e86f7d
Compare
0e86f7d
to
282d9e9
Compare
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.
This is looking ace @domoscargin
Just merged #4261 so let's give this one a rebase and drop the [data-module="${Tabs.moduleName}"]
prefix then think we're good to go 🚀
Since `setup()` is run during initialisation, we've already validated `this.$tabs` is not empty, and thrown if it is. As a result, `$activeTab` will always be set to SOMETHING, since we know `this.$tabs[0]` is valid. If `setup()` were to become an API method that could be called separately, we'd need to validate the `$tabs` list in some way anyway.
282d9e9
to
377ea39
Compare
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.
✅ Approved
(One little comment, but only a quick tweak)
4431b66
to
94ebb2c
Compare
Closes #4127
A coupla notes:
setup()
as unnecessary. Some checks will need to replace it ifsetup()
becomes an API method that can be called separately from initialisation, but I figure we'd probably do a slight code refactor then anyway.