-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(compat): fix compat handler of draggable #12445
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
base: main
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
| expect(app2.config.globalProperties.test).toBe(undefined) | ||
| }) | ||
|
|
||
| test('ATTR_ENUMERATED_COERCION: true', () => { |
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.
I'm wondering whether the tests for this should be in misc.spec.ts instead, as there are already tests for ATTR_ENUMERATED_COERCION in that file?
| value === null || value === false || value === 'false' | ||
| ? 'false' | ||
| : typeof value !== 'boolean' && value !== undefined | ||
| : value !== undefined |
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.
I think the logic is correct, but it might be easier to understand if the undefined check were handled first?
f006bad to
2a58947
Compare
WalkthroughUpdated compat enumerated-attribute coercion so string Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner
participant VueCompat
participant compatCoerceAttr
participant DOM
TestRunner->>VueCompat: mount template with ATTR_ENUMERATED_COERCION enabled
VueCompat->>compatCoerceAttr: coerce attribute "draggable" with value "false"
compatCoerceAttr-->>VueCompat: returns "false"
VueCompat->>DOM: render element with draggable="false"
VueCompat-->>TestRunner: emit deprecation warning(s)
TestRunner->>TestRunner: assert DOM and warnings
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/vue-compat/__tests__/misc.spec.ts (1)
287-289: Note: Pre-existing type annotation pattern (not blocking).The static analysis tool flags the use of
Functionas a type, suggesting to explicitly define the function shape. However, this pattern is used consistently throughout the file (lines 262, 268, 274, etc.), so this is a pre-existing codebase pattern rather than an issue introduced by this change.🧰 Tools
🪛 Biome (1.9.4)
[error] 288-288: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/runtime-dom/src/modules/attrs.ts(1 hunks)packages/vue-compat/__tests__/misc.spec.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/runtime-dom/src/modules/attrs.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/vue-compat/__tests__/misc.spec.ts
[error] 288-288: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: test / e2e-test
- GitHub Check: test / unit-test-windows
🔇 Additional comments (1)
packages/vue-compat/__tests__/misc.spec.ts (1)
279-291: LGTM! Good test coverage for the compatibility flag.The new test case effectively verifies that when
ATTR_ENUMERATED_COERCIONis explicitly enabled, thedraggable="false"attribute is preserved correctly and the appropriate deprecation warning is emitted. This complements the existing test and follows the established testing patterns in the file.🧰 Tools
🪛 Biome (1.9.4)
[error] 288-288: Don't use 'Function' as a type.
Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.
(lint/complexity/noBannedTypes)
skirtles-code
left a comment
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.
A few more thoughts on the test...
fix #12444

Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.