chore(form-core): make testing form registration easier
This commit is contained in:
parent
355aabc02c
commit
d9d88b7f55
3 changed files with 11 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
"src",
|
"src",
|
||||||
"test",
|
"test",
|
||||||
"test-helpers",
|
"test-helpers",
|
||||||
|
"test-suites",
|
||||||
"translations",
|
"translations",
|
||||||
"types"
|
"types"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,14 @@ const FormRegisteringMixinImplementation = superclass =>
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
|
this.__unregisterFormElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Putting this in a separate method makes testing easier
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
__unregisterFormElement() {
|
||||||
if (this._parentFormGroup) {
|
if (this._parentFormGroup) {
|
||||||
this._parentFormGroup.removeFormElement(/** @type {* & FormRegisteringHost} */ (this));
|
this._parentFormGroup.removeFormElement(/** @type {* & FormRegisteringHost} */ (this));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ export declare class FormRegisteringHost {
|
||||||
* ChoiceGroup
|
* ChoiceGroup
|
||||||
*/
|
*/
|
||||||
protected _parentFormGroup: FormRegistrarHost | undefined;
|
protected _parentFormGroup: FormRegistrarHost | undefined;
|
||||||
|
|
||||||
|
private __unregisterFormElement: void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function FormRegisteringImplementation<T extends Constructor<LitElement>>(
|
export declare function FormRegisteringImplementation<T extends Constructor<LitElement>>(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue