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

Vue3: Fix support for onX and empty attributes in Show Code #25219

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
295124b
fix: Complementary validation of the "directiveSource" - Add "on" pre…
Tap-Kim Dec 13, 2023
807872a
update: Return value "undefined" to empty string.
Tap-Kim Dec 13, 2023
7a84001
test: Add function test code
Tap-Kim Dec 13, 2023
fa60836
fix: Return "key" string lowercase
Tap-Kim Dec 13, 2023
4c4a9fd
fix: Modify lint error
Tap-Kim Dec 14, 2023
5fda6d7
test: Modify toMatchInlineSnapshot
Tap-Kim Dec 14, 2023
7fcd797
fix: Add empty object test code
Tap-Kim Dec 14, 2023
6845ff0
fix: Lint error
Tap-Kim Dec 14, 2023
dc1ec02
fix: ci error - lint, unit test
Tap-Kim Dec 15, 2023
e6da644
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 15, 2023
a165460
fix: ci error - unit test
Tap-Kim Dec 15, 2023
c3de439
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 16, 2023
fef21ff
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 18, 2023
7e1dce6
fix: Reflect empty function logic removal feedback
Tap-Kim Dec 19, 2023
7e03bad
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 20, 2023
5eb7b1c
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 22, 2023
80e88e8
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Dec 26, 2023
fea6c81
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Jan 7, 2024
5b1ff1b
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Jan 16, 2024
709b759
Merge branch 'next' into fix-vue3-showcode-attributeSoruce-prefix-val…
Tap-Kim Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/renderers/vue3/src/docs/sourceDecorator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ describe('Vue3: sourceDecorator->attributeSoure()', () => {
it('normal html attribute should not convert to vue event directive', () => {
expect(attributeSource('on-click', () => {})).toMatchInlineSnapshot(`on-click='()=>({})'`);
});
it('The value undefined or empty string must not be returned.', () => {
expect(attributeSource('icon', undefined)).toMatchInlineSnapshot(`icon=""`);
expect(attributeSource('icon', '')).toMatchInlineSnapshot(`icon=""`);
});
it('htmlEventAttributeToVueEventAttribute onEv => v-on:', () => {
const htmlEventAttributeToVueEventAttribute = (attribute: string) => {
return htmlEventToVueEvent(attribute);
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue3/src/docs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const htmlEventAttributeToVueEventAttribute = (key: string) => {
};

const directiveSource = (key: string, value: unknown) =>
key.includes('on')
key.toLowerCase().startsWith('on')
? `${htmlEventAttributeToVueEventAttribute(key)}='()=>({})'`
: `${key}="${value}"`;
: `${key}="${value || ''}"`;

const attributeSource = (key: string, value: unknown, dynamic?: boolean) =>
// convert html event key to vue event key
Expand Down
Loading