Skip to content
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 all special characters in IDs, except whitespace. #2231

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

jeresig
Copy link
Member

@jeresig jeresig commented May 20, 2024

Summary:

This came up with the Perseus team, where they had some Unicode characters in an ID and that was throwing errors. I did some more research and learned that only whitespace is considered to be invalid, so I updated our logic around this.

Issue: WB-1704

Test plan:

I ran the tests and they passed.

@jeresig jeresig self-assigned this May 20, 2024
Copy link

changeset-bot bot commented May 20, 2024

🦋 Changeset detected

Latest commit: e384dff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@khanacademy/wonder-blocks-core Patch
@khanacademy/wonder-blocks-accordion Patch
@khanacademy/wonder-blocks-banner Patch
@khanacademy/wonder-blocks-birthday-picker Patch
@khanacademy/wonder-blocks-breadcrumbs Patch
@khanacademy/wonder-blocks-button Patch
@khanacademy/wonder-blocks-cell Patch
@khanacademy/wonder-blocks-clickable Patch
@khanacademy/wonder-blocks-data Patch
@khanacademy/wonder-blocks-dropdown Patch
@khanacademy/wonder-blocks-form Patch
@khanacademy/wonder-blocks-grid Patch
@khanacademy/wonder-blocks-icon-button Patch
@khanacademy/wonder-blocks-icon Patch
@khanacademy/wonder-blocks-labeled-field Patch
@khanacademy/wonder-blocks-layout Patch
@khanacademy/wonder-blocks-link Patch
@khanacademy/wonder-blocks-modal Patch
@khanacademy/wonder-blocks-pill Patch
@khanacademy/wonder-blocks-popover Patch
@khanacademy/wonder-blocks-progress-spinner Patch
@khanacademy/wonder-blocks-search-field Patch
@khanacademy/wonder-blocks-switch Patch
@khanacademy/wonder-blocks-testing Patch
@khanacademy/wonder-blocks-toolbar Patch
@khanacademy/wonder-blocks-tooltip Patch
@khanacademy/wonder-blocks-typography Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/famous-birds-compare.md, packages/wonder-blocks-core/src/util/unique-id-factory.ts, packages/wonder-blocks-core/src/util/__tests__/unique-id-factory.test.ts, packages/wonder-blocks-core/src/util/__tests__/__snapshots__/unique-id-factory.test.ts.snap

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team May 20, 2024 19:26
Copy link
Contributor

Size Change: -32 B (-0.03%)

Total Size: 96.5 kB

Filename Size Change
packages/wonder-blocks-core/dist/es/index.js 3.67 kB -32 B (-0.87%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.78 kB
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.72 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 1.13 kB
packages/wonder-blocks-button/dist/es/index.js 4.28 kB
packages/wonder-blocks-cell/dist/es/index.js 2.24 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.29 kB
packages/wonder-blocks-data/dist/es/index.js 6.33 kB
packages/wonder-blocks-dropdown/dist/es/index.js 13.9 kB
packages/wonder-blocks-form/dist/es/index.js 5.31 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-i18n/dist/es/index.js 4.56 kB
packages/wonder-blocks-icon-button/dist/es/index.js 3.21 kB
packages/wonder-blocks-icon/dist/es/index.js 1.06 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 72 B
packages/wonder-blocks-layout/dist/es/index.js 1.89 kB
packages/wonder-blocks-link/dist/es/index.js 2.53 kB
packages/wonder-blocks-modal/dist/es/index.js 5.52 kB
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB
packages/wonder-blocks-popover/dist/es/index.js 4.86 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.51 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.55 kB
packages/wonder-blocks-switch/dist/es/index.js 2.1 kB
packages/wonder-blocks-testing/dist/es/index.js 3.94 kB
packages/wonder-blocks-theming/dist/es/index.js 697 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 1.74 kB
packages/wonder-blocks-toolbar/dist/es/index.js 857 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.91 kB
packages/wonder-blocks-typography/dist/es/index.js 1.49 kB

compressed-size-action

Copy link
Contributor

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (7952cc3) and published all packages with changesets to npm.

You can install the packages in webapp by running:

./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2231"

Packages can also be installed manually by running:

yarn add @khanacademy/wonder-blocks-<package-name>@PR2231

Copy link
Contributor

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-uqhacvoiae.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 327
Tests with visual changes 0
Total stories 413
Inherited (not captured) snapshots [TurboSnap] 0
Tests on the build 327

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.09%. Comparing base (f01e83d) to head (e384dff).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2231      +/-   ##
==========================================
+ Coverage   94.43%   95.09%   +0.66%     
==========================================
  Files         248      248              
  Lines       29238    29237       -1     
  Branches     1643     2329     +686     
==========================================
+ Hits        27611    27804     +193     
+ Misses       1623     1429     -194     
  Partials        4        4              
Files Coverage Δ
...s/wonder-blocks-core/src/util/unique-id-factory.ts 93.44% <100.00%> (+3.12%) ⬆️

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f01e83d...e384dff. Read the comment docs.

Copy link
Member

@jandrade jandrade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and nice catch! :shipit:

@@ -33,14 +33,13 @@ export default class UniqueIDFactory implements IIdentifierFactory {
* identifier. It does not assert that a string IS a valid identifier (for
* example, that it doesn't start with numbers). We don't need to do that
* here because all identifiers are prefixed to avoid needing that check.
*
* According to this post:
* https://stackoverflow.com/questions/70579/html-valid-id-attribute-values/31773673#31773673
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this link!

@jeresig jeresig merged commit 5dfac06 into main May 21, 2024
16 checks passed
@jeresig jeresig deleted the WB-1704 branch May 21, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants