Skip to content

Commit

Permalink
fix(compiler): register components with index name (#465)
Browse files Browse the repository at this point in the history
* fix(compiler): register components with index name

* test(compiler): register with index name
  • Loading branch information
redgeoff authored Sep 11, 2021
1 parent 35c09c0 commit 79da78d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ export class Compiler {
}

registerComponents(components) {
each(components, (component) =>
this.registerComponent(component.name, component)
Object.keys(components).forEach((name) =>
this.registerComponent(name, components[name])
);
}

Expand Down
8 changes: 8 additions & 0 deletions src/compiler/compiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,3 +775,11 @@ it('should share template parameters', async () => {

await component.runListeners('foo');
});

it('should register components with index name', async () => {
const components = {
'app.FooIt': FooIt,
};
compiler.registerComponents(components);
expect(compiler.exists('app.FooIt')).toEqual(true);
});

0 comments on commit 79da78d

Please sign in to comment.