refactor(exam-correct): remove old input--invalid class usage

This commit is contained in:
Sarah Vaupel 2020-01-24 09:49:26 +01:00 committed by Gregor Kleen
parent ef3475539b
commit 76cb690303

View File

@ -2,11 +2,11 @@ import { Utility } from '../../core/utility';
import { StorageManager, LOCATION } from '../../lib/storage-manager/storage-manager';
import { HttpClient } from '../../services/http-client/http-client';
import './exam-correct.sass';
import Cookies from 'js-cookie';
import moment from 'moment';
import './exam-correct.sass';
const EXAM_CORRECT_URL_POST = 'correct';
const EXAM_CORRECT_HEADERS = {
@ -26,8 +26,6 @@ const EXAM_CORRECT_INPUT_BODY_ID = 'exam-correct__new';
const EXAM_CORRECT_USER_ATTR = 'exam-correct--user-id';
const EXAM_CORRECT_USER_DNAME_ATTR = 'exam-correct--user-dname';
const INPUT_EMPTY_CLASS = 'input--invalid';
const STATUS = {
NONE: null,
SUCCESS: 'success',
@ -110,7 +108,6 @@ export class ExamCorrect {
destroy() {
this._sendBtn.removeEventListener('click', this._sendCorrectionHandler);
this._userInput.removeEventListener('change', this._validateUserInput);
this._userInput.removeEventListener('input', this._removeInputEmptyClassHandler);
// TODO destroy handlers on user input candidate elements
}
@ -169,8 +166,6 @@ export class ExamCorrect {
// abort send if the user input is empty
if (!user && !userId) {
this._userInput.classList.add(INPUT_EMPTY_CLASS);
this._userInput.addEventListener('input', this._removeInputEmptyClassHandler.bind(this), { once: true });
return;
}
@ -343,14 +338,6 @@ export class ExamCorrect {
}
}
_removeInputEmptyClassHandler() {
if (this._userInput.value) {
this._userInput.classList.remove(INPUT_EMPTY_CLASS);
} else {
this._userInput.addEventListener('input', this._removeInputEmptyClassHandler, { once: true });
}
}
// TODO better name
_showUserList(row, users, results) {
let userElem = row.cells.item(this._cIndices.get('user'));