Skip to content

Commit e3c498e

Browse files
committed
Tweak fix for attributeBindings after review
1 parent 01e2b27 commit e3c498e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/__tests__/find-properties.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('findAttributeBindings()', () => {
6262
const TESTS = [
6363
['', new Map()],
6464
["attributeBindings: ['foo']", new Map([['foo', 'foo']])],
65-
["attributeBindings: ['foo:bar', 'BAZ']", new Map([['foo', 'bar'], ['BAZ', 'BAZ']])],
65+
["attributeBindings: ['foo:bar', 'BAZ']", new Map([['bar', 'foo'], ['BAZ', 'BAZ']])],
6666
["attributeBindings: ''", /Unexpected `attributeBindings` value: ''/],
6767
['attributeBindings: 5', /Unexpected `attributeBindings` value: 5/],
6868
['attributeBindings: foo', /Unexpected `attributeBindings` value: foo/],

lib/transform.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function transform(source, template, options = {}) {
205205
if (elementId) {
206206
attrs.push(b.attr('id', b.text(elementId)));
207207
}
208-
attributeBindings.forEach((key, value) => {
208+
attributeBindings.forEach((value, key) => {
209209
attrs.push(b.attr(key, b.mustache(`this.${value}`)));
210210
});
211211
if (classNodes.length === 1) {
@@ -288,8 +288,8 @@ function findStringArrayProperties(properties, name) {
288288
function findAttributeBindings(properties) {
289289
let attrBindings = new Map();
290290
for (let binding of findStringArrayProperties(properties, 'attributeBindings')) {
291-
let [from, to] = binding.split(':');
292-
attrBindings.set(from, to || from);
291+
let [value, attr] = binding.split(':');
292+
attrBindings.set(attr || value, value);
293293
}
294294

295295
return attrBindings;

0 commit comments

Comments
 (0)