Skip to content
Snippets Groups Projects
Unverified Commit 8215d207 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Fix name switching (#5)

parent ff65809f
No related branches found
No related tags found
No related merge requests found
Pipeline #11019 passed
...@@ -59,12 +59,18 @@ export class TextSwitch extends LitElement { ...@@ -59,12 +59,18 @@ export class TextSwitch extends LitElement {
} }
update(changedProperties) { update(changedProperties) {
if (this._active === BUTTON1) {
this.name = this.name1;
} else {
this.name = this.name2;
}
changedProperties.forEach((oldValue, propName) => { changedProperties.forEach((oldValue, propName) => {
if (propName === "name") { if (propName === "name") {
if (this[propName] == this.name1) { if (this[propName] === this.name1) {
this._active = BUTTON1; this._active = BUTTON1;
} }
if (this[propName] == this.name2) { if (this[propName] === this.name2) {
this._active = BUTTON2; this._active = BUTTON2;
} }
} else if (propName === "_active") { } else if (propName === "_active") {
...@@ -76,12 +82,6 @@ export class TextSwitch extends LitElement { ...@@ -76,12 +82,6 @@ export class TextSwitch extends LitElement {
} }
}); });
if (this._active === BUTTON1) {
this.name = this.name1;
} else {
this.name = this.name2;
}
super.update(changedProperties); super.update(changedProperties);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment