Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/component-base/src/element-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ export declare function ElementMixin<T extends Constructor<HTMLElement>>(
export declare class ElementMixinClass {
static is: string;
static version: string;

protected static finalize(): void;
}
6 changes: 3 additions & 3 deletions packages/component-base/src/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const registered = new Set();
export const ElementMixin = (superClass) =>
class VaadinElementMixin extends DirMixin(superClass) {
/** @protected */
static finalize() {
super.finalize();

static _ensureRegistrations() {
const { is } = this;

// Registers a class prototype for telemetry purposes.
Expand All @@ -66,5 +64,7 @@ export const ElementMixin = (superClass) =>
'Vaadin components require the "standards mode" declaration. Please add <!DOCTYPE html> to the HTML document.',
);
}

this.constructor._ensureRegistrations();
}
};
2 changes: 2 additions & 0 deletions packages/component-base/test/element-mixin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@

before(() => {
ElementFoo = defineCE('element-foo');
flush();
});

it('should store the class entry in registrations once instance created', () => {
expect(window.Vaadin.registrations.length).to.equal(0);

Check warning on line 47 in packages/component-base/test/element-mixin.test.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=vaadin_web-components&issues=AZzmVB2H_aT8C8SOe9bc&open=AZzmVB2H_aT8C8SOe9bc&pullRequest=11354
document.createElement(ElementFoo.is);
flush();
expect(window.Vaadin.registrations).to.be.instanceOf(Array);
Expand Down
Loading