document.getElementById("testerNameInput").addEventListener("change", handleSet);
document.getElementById("terterNameErase").addEventListener("click", handleErase);

function handleSet(e) {
    e.preventDefault()
    const testerName = document.getElementById("testerNameInput").value
    if (!testerName) {
        return
    }

    chrome.runtime.sendMessage({
        kind: "changeTesterName",
        testerName
    }, {}, response => {
        if (response) {
            getState();
        }
    });
}

function handleErase(e) {
    e.preventDefault()

    chrome.runtime.sendMessage({
        kind: "changeTesterName",
        testerName: ""
    }, {}, response => {
        if (response) {
            getState();
        }
    });
}
