From 136af6028e456e27d1e8efca4c13f149dc5e4c79 Mon Sep 17 00:00:00 2001 From: JonathanMM Date: Wed, 12 Jan 2022 08:54:13 +0100 Subject: [PATCH] Ajout d'un message quand le mot saisi est trop court --- ts/gestionnaire.ts | 4 ++++ ts/input.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ts/gestionnaire.ts b/ts/gestionnaire.ts index e013f17..22830de 100644 --- a/ts/gestionnaire.ts +++ b/ts/gestionnaire.ts @@ -79,6 +79,10 @@ export default class Gestionnaire { public verifierMot(mot: string, skipAnimation: boolean = false): void { mot = this._dictionnaire.nettoyerMot(mot); //console.debug(mot + " => " + (this._dictionnaire.estMotValide(mot) ? "Oui" : "non")); + if (mot.length !== this._motATrouver.length) { + NotificationMessage.ajouterNotification("Le mot proposé est trop court"); + return; + } if (mot[0] !== this._motATrouver[0]) { NotificationMessage.ajouterNotification("Le mot proposé doit commencer par la même lettre que le mot recherché"); return; diff --git a/ts/input.ts b/ts/input.ts index b91c3dc..909298d 100644 --- a/ts/input.ts +++ b/ts/input.ts @@ -76,8 +76,8 @@ export default class Input { private validerMot(): void { if (this._estBloque) return; let mot = this._motSaisi; + this._gestionnaire.verifierMot(mot); if (mot.length === this._longueurMot) { - this._gestionnaire.verifierMot(mot); this._motSaisi = ""; } }