cleanup special 'definedProperties' field in Node
'definedProperties' seems like module-meta-data, which shouldn't be on a Node instance.
This commit is contained in:
parent
95b283faa8
commit
a624c00554
@ -26,7 +26,7 @@ describe('parser/javascript/node.js', function() {
|
|||||||
expect(setup).toHaveBeenCalled();
|
expect(setup).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets up any defined properties', function() {
|
it('sets up any defined properties and removes \'definedProperties\' field', function() {
|
||||||
this.node.module = {
|
this.node.module = {
|
||||||
definedProperties: {
|
definedProperties: {
|
||||||
example: {
|
example: {
|
||||||
@ -37,6 +37,7 @@ describe('parser/javascript/node.js', function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
expect(this.node.example).toEqual('value');
|
expect(this.node.example).toEqual('value');
|
||||||
|
expect(this.node.definedProperties).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -30,6 +30,8 @@ export default class Node {
|
|||||||
_.forOwn(this.definedProperties || {}, (methods, name) => {
|
_.forOwn(this.definedProperties || {}, (methods, name) => {
|
||||||
Object.defineProperty(this, name, methods);
|
Object.defineProperty(this, name, methods);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
delete this.definedProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The SVG element to render this node into. A node-type class is
|
// The SVG element to render this node into. A node-type class is
|
||||||
|
Loading…
Reference in New Issue
Block a user