Skip to content

Commit

Permalink
Merge pull request #123 from StrahilKazlachev/fix/attribute/primary-p…
Browse files Browse the repository at this point in the history
…roperty

fix(syntax-interpreter): use the hyphenated name
  • Loading branch information
EisenbergEffect authored Feb 14, 2018
2 parents 6d7f6f2 + 4e4c427 commit 75c1e38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/syntax-interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class SyntaxInterpreter {
_getPrimaryPropertyName(resources, context) {
let type = resources.getAttribute(context.attributeName);
if (type && type.primaryProperty) {
return type.primaryProperty.name;
return type.primaryProperty.attribute;
}
return null;
}
Expand Down
20 changes: 2 additions & 18 deletions test/syntax-interpreter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ describe('SyntaxInterpreter', () => {
info.attrValue = "bar";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
primaryProperty: { attribute: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
Expand All @@ -286,7 +286,7 @@ describe('SyntaxInterpreter', () => {
info.attrValue = "bar;";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
primaryProperty: { attribute: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
Expand All @@ -298,10 +298,6 @@ describe('SyntaxInterpreter', () => {

info.attrValue = "foo: bar";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
expect(instruction.attributes['foo']).toBe('bar');
});
Expand All @@ -311,10 +307,6 @@ describe('SyntaxInterpreter', () => {

info.attrValue = "foo: bar;";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
expect(instruction.attributes['foo']).toBe('bar');
});
Expand All @@ -324,10 +316,6 @@ describe('SyntaxInterpreter', () => {

info.attrValue = "far: boo";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
expect(instruction.attributes['far']).toBe('boo');
});
Expand All @@ -337,10 +325,6 @@ describe('SyntaxInterpreter', () => {

info.attrValue = "far: boo;";

spyOn(resources,'getAttribute').and.returnValue({
primaryProperty: { name: 'foo' }
});

let instruction = interpreter.options(resources, null, info, null, { attributeName: 'foo' });
expect(instruction.attributes['far']).toBe('boo');
});
Expand Down

0 comments on commit 75c1e38

Please sign in to comment.