Skip to content

Commit

Permalink
chore: rename properties
Browse files Browse the repository at this point in the history
  • Loading branch information
moajo committed Dec 16, 2017
1 parent beecaf5 commit 9877e1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Core/GomlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class GomlNode extends EEObject {
this._attributeManager = new AttributeManager(declaration.name.name);

this.element.setAttribute(Constants.x_gr_id, this.id);
const defaultComponentNames = declaration.requiredComponentsActual;
const defaultComponentNames = declaration.defaultComponentsActual;

// instanciate default components
defaultComponentNames.forEach(id => {
Expand Down
6 changes: 3 additions & 3 deletions src/Core/GrimoireInterfaceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ export default class GrimoireInterfaceImpl extends EEObject {
* register new node to context.
* throw error if already registerd.
* @param name
* @param requiredComponents
* @param defaultComponents
* @param defaults
* @param superNode
* @param freezeAttributes
*/
public registerNode(
name: Name,
requiredComponents: (Name | Ctor<Component>)[] = [],
defaultComponents: (Name | Ctor<Component>)[] = [],
defaults?: { [key: string]: any },
superNode?: Name,
freezeAttributes?: Name[]): NodeDeclaration {
Expand All @@ -317,7 +317,7 @@ export default class GrimoireInterfaceImpl extends EEObject {
if (this.debug && !Utility.isKebabCase(registerId.name)) {
console.warn(`node ${registerId.name} is registerd. but,it should be 'snake-case'.`);
}
const declaration = new NodeDeclaration(registerId, requiredComponents || [], defaults || {}, superNode, freezeAttributes);
const declaration = new NodeDeclaration(registerId, defaultComponents || [], defaults || {}, superNode, freezeAttributes);
this.nodeDeclarations.set(registerId, declaration);
return declaration;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Core/NodeDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class NodeDeclaration {
/**
* get required components with inheritance in mind.
*/
public get requiredComponentsActual(): IdentitySet {
public get defaultComponentsActual(): IdentitySet {
if (!this._resolvedDependency) {
throw new Error(`${this.name.fqn} is not resolved dependency!`);
}
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class NodeDeclaration {
throw new Error(`In node '${this.name.fqn}': super node ${this.superNode.fqn} is not found when resolving inherits, it has registerd correctry?`);
}
superNode.resolveDependency();
const inheritedDefaultComponents = superNode.requiredComponentsActual;
const inheritedDefaultComponents = superNode.defaultComponentsActual;
const inheritedDefaultAttribute = superNode.defaultAttributesActual;
this._requiredComponentsActual = inheritedDefaultComponents.clone().merge(this.requiredComponents);
this._defaultAttributesActual = inheritedDefaultAttribute.clone().pushDictionary(this.defaultAttributes);
Expand Down
6 changes: 3 additions & 3 deletions test/Core/GrimoireInterfaceTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ test("registerNode/Component works correctly.", async t => {
const a1 = GrimoireInterface.nodeDeclarations.get("a1");
const a2 = GrimoireInterface.nodeDeclarations.get("a2");
const a3 = GrimoireInterface.nodeDeclarations.get("a3");
t.truthy(a1.requiredComponentsActual.toArray().length === 1); // grimoireCompone
t.truthy(a2.requiredComponentsActual.toArray().length === 2); // grimoireCompone
t.truthy(a3.requiredComponentsActual.toArray().length === 2); // grimoireCompone
t.truthy(a1.defaultComponentsActual.toArray().length === 1); // grimoireCompone
t.truthy(a2.defaultComponentsActual.toArray().length === 2); // grimoireCompone
t.truthy(a3.defaultComponentsActual.toArray().length === 2); // grimoireCompone

// console.log(a2.idResolver)
t.truthy(a2.idResolver.resolve(Namespace.define("hoge")) === "grimoirejs.Hoge.hoge");
Expand Down

0 comments on commit 9877e1e

Please sign in to comment.