From 67c4bbb3e0c0f5a25ef3689641438a510f958bff Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Thu, 26 Nov 2020 11:29:10 +0000 Subject: [PATCH 1/3] Remove attribute if type is function --- addons/docs/src/frameworks/vue/sourceDecorator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/docs/src/frameworks/vue/sourceDecorator.ts b/addons/docs/src/frameworks/vue/sourceDecorator.ts index 749ed00ab932..04975f10420c 100644 --- a/addons/docs/src/frameworks/vue/sourceDecorator.ts +++ b/addons/docs/src/frameworks/vue/sourceDecorator.ts @@ -123,7 +123,7 @@ export function vnodeToString(vnode: Vue.VNode): string { } function stringifyAttr(attrName: string, value?: any): string | null { - if (typeof value === 'undefined') { + if (typeof value === 'undefined' || typeof value === 'function') { return null; } From fc6a4bf9339e17fc79c703eb75e66df1b51f2134 Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Fri, 27 Nov 2020 10:44:35 +0000 Subject: [PATCH 2/3] Add more attributes to sourceDecorator tests --- .../docs/src/frameworks/vue/sourceDecorator.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/docs/src/frameworks/vue/sourceDecorator.test.ts b/addons/docs/src/frameworks/vue/sourceDecorator.test.ts index 9f21c563720b..c63d8c477477 100644 --- a/addons/docs/src/frameworks/vue/sourceDecorator.test.ts +++ b/addons/docs/src/frameworks/vue/sourceDecorator.test.ts @@ -32,7 +32,7 @@ describe('vnodeToString', () => { it('attributes', () => { const MyComponent: ComponentOptions = { - props: ['propA', 'propB', 'propC', 'propD'], + props: ['propA', 'propB', 'propC', 'propD', 'propE', 'propF', 'propG', 'propH'], template: '
', }; @@ -48,7 +48,16 @@ describe('vnodeToString', () => { propC: null, propD: { foo: 'bar', + bar: 'foo', }, + propE: 'propE', + propF: true, + propG() { + const foo = 'bar'; + + return foo; + }, + propH: undefined, }, }; }, @@ -56,7 +65,7 @@ describe('vnodeToString', () => { }) ) ).toMatchInlineSnapshot( - `` + `` ); }); From 75896505708972f06821d6331431dedfe81579aa Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Fri, 27 Nov 2020 10:49:27 +0000 Subject: [PATCH 3/3] Update sourceDecorator test --- .../docs/src/frameworks/vue/sourceDecorator.test.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/addons/docs/src/frameworks/vue/sourceDecorator.test.ts b/addons/docs/src/frameworks/vue/sourceDecorator.test.ts index c63d8c477477..b02569d9aa62 100644 --- a/addons/docs/src/frameworks/vue/sourceDecorator.test.ts +++ b/addons/docs/src/frameworks/vue/sourceDecorator.test.ts @@ -32,7 +32,7 @@ describe('vnodeToString', () => { it('attributes', () => { const MyComponent: ComponentOptions = { - props: ['propA', 'propB', 'propC', 'propD', 'propE', 'propF', 'propG', 'propH'], + props: ['propA', 'propB', 'propC', 'propD', 'propE', 'propF', 'propG'], template: '
', }; @@ -48,16 +48,14 @@ describe('vnodeToString', () => { propC: null, propD: { foo: 'bar', - bar: 'foo', }, - propE: 'propE', - propF: true, - propG() { + propE: true, + propF() { const foo = 'bar'; return foo; }, - propH: undefined, + propG: undefined, }, }; }, @@ -65,7 +63,7 @@ describe('vnodeToString', () => { }) ) ).toMatchInlineSnapshot( - `` + `` ); });