Skip to content

Commit a76f8b4

Browse files
authored
Merge pull request #28 from vladucu/fix-attribute-bindings-issue
Fix attributeBindings issue
2 parents 2b262bd + e3c498e commit a76f8b4

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/__tests__/__snapshots__/transform.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ foo
4141
});
4242
4343
~~~~~~~~~~
44-
<div foo={{this.foo}} bar={{this.baz}} ...attributes>
44+
<div foo={{this.foo}} baz={{this.bar}} ...attributes>
4545
foo
4646
</div>
4747
=========="

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)