From 15c1196673e2879384f357e2866886236b8ae865 Mon Sep 17 00:00:00 2001 From: Ufuk Ustali <93888971+UfukUstali@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:00:12 +0100 Subject: [PATCH] Correctly populate `dynamicAttrs` for custom attributes (#225) * Fix `dynamicAttrs` in `options.js` * Add test --------- Co-authored-by: Jordan Pittman --- src/options.js | 6 +++--- tests/fixtures.test.js | 1 + tests/fixtures/custom-vue/index.vue | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/options.js b/src/options.js index 92515294..37aa4175 100644 --- a/src/options.js +++ b/src/options.js @@ -67,10 +67,10 @@ export function getCustomizations(options, parser, defaults) { // Generate a list of dynamic attributes for (let attr of staticAttrs) { if (parser === 'vue') { - dynamicAttrs.add(`:${attr.name}`) - dynamicAttrs.add(`v-bind:${attr.name}`) + dynamicAttrs.add(`:${attr}`) + dynamicAttrs.add(`v-bind:${attr}`) } else if (parser === 'angular') { - dynamicAttrs.add(`[${attr.name}]`) + dynamicAttrs.add(`[${attr}]`) } } diff --git a/tests/fixtures.test.js b/tests/fixtures.test.js index 0ea7f30e..291df29c 100644 --- a/tests/fixtures.test.js +++ b/tests/fixtures.test.js @@ -98,6 +98,7 @@ let e = dontSortMeTemplate\`sm:p-1 p-2\`; `, }, ] diff --git a/tests/fixtures/custom-vue/index.vue b/tests/fixtures/custom-vue/index.vue index e1a3b789..bbd3ef98 100644 --- a/tests/fixtures/custom-vue/index.vue +++ b/tests/fixtures/custom-vue/index.vue @@ -8,4 +8,5 @@