mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] store: connected component reuse base component name
Connected component should have a unique name. To achieve this the connected component currently have an id based generated name (like `ConnectedComponent1`). To make it clearer and ease debugging this commit reuse the extended component's name to include it in the generated name in the form of `Connected<ComponentName>`.
This commit is contained in:
committed by
Géry Debongnie
parent
35c1de26b8
commit
5524c2e323
@@ -1157,4 +1157,21 @@ describe("connecting a component to store", () => {
|
||||
expect(fixture.innerHTML).toBe("<div>b</div>");
|
||||
expect(steps).toEqual(["willpatch", "patched"]);
|
||||
});
|
||||
|
||||
test("connected component has its own name", () => {
|
||||
function mapStoreToProps() { }
|
||||
|
||||
class Named extends Component<any, any, any> { };
|
||||
const namedConnected = connect(Named, mapStoreToProps);
|
||||
expect(namedConnected.name).toMatch('ConnectedNamed');
|
||||
|
||||
class ParentNamed extends Component<any, any, any>{};
|
||||
class ChildNamed extends ParentNamed{};
|
||||
const childConnected = connect(ChildNamed, mapStoreToProps)
|
||||
expect(childConnected.name).toMatch('ConnectedChildNamed')
|
||||
|
||||
const Anonymous = class extends Component<any, any, any>{ };
|
||||
const anonymousConnected = connect(Anonymous, mapStoreToProps);
|
||||
expect(anonymousConnected.name).toMatch(/^Connectedclass_\d+/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user