Skip to content

Commit

Permalink
Correctly populate dynamicAttrs for custom attributes (#225)
Browse files Browse the repository at this point in the history
* Fix `dynamicAttrs` in `options.js`

* Add test

---------

Co-authored-by: Jordan Pittman <[email protected]>
  • Loading branch information
UfukUstali and thecrypticace authored Nov 8, 2023
1 parent c51df4d commit 15c1196
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}]`)
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ let e = dontSortMeTemplate\`sm:p-1 p-2\`;
<template>
<div class="p-2 sm:p-1" sortMe="p-2 sm:p-1" dontSortMe="sm:p-1 p-2"></div>
<div :class="{ 'p-2 sm:p-1': true }"></div>
<div :sortMe="{ 'p-2 sm:p-1': true }"></div>
</template>`,
},
]
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/custom-vue/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<template>
<div class="sm:p-1 p-2" sortMe="sm:p-1 p-2" dontSortMe="sm:p-1 p-2"></div>
<div :class="{'sm:p-1 p-2': true}"></div>
<div :sortMe="{'sm:p-1 p-2': true}"></div>
</template>

0 comments on commit 15c1196

Please sign in to comment.