From 638fb400a1f3c31510b33391e57c987379c49b2d Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 17 Jan 2025 13:03:25 -0800 Subject: [PATCH] Adjust test form element names and extract function so other event listeners can use them possibly. --- test.html | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test.html b/test.html index d95e69e..3d26652 100644 --- a/test.html +++ b/test.html @@ -117,32 +117,33 @@ SPDX-License-Identifier: GPL-3.0-or-later console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold') } - document.getElementById('validate').addEventListener('click', e => { - console.log(e) + function startValidation (event) { const work = document.getElementById('work') const hash = document.getElementById('hash') - const validated = document.getElementById('validated') - validated.innerText = '' + const validation = document.getElementById('validation') + validation.innerText = '' NanoPow.validate(work.value, hash.value) .then(result => { - validated.innerText = result + validation.innerText = result ? 'Valid' : 'INVALID' }) .catch(err => { console.error(err) - validated.innerText = err.message + validation.innerText = err.message }) - }) + } + document.getElementById('btnStartValidation').addEventListener('click', startValidation) - document.getElementById('go').addEventListener('click', e => { + function startTest (event) { const size = document.getElementById('size') const effort = document.getElementById('effort') const isOutputShown = document.getElementById('isOutputShown') const isGlForced = document.getElementById('isGlForced') const isDebug = document.getElementById('isDebug') run(+size.value, +effort.value, isOutputShown.checked, isGlForced.checked, isDebug.checked) - }) + } + document.getElementById('btnStartTest').addEventListener('click', startTest) @@ -160,11 +161,11 @@ SPDX-License-Identifier: GPL-3.0-or-later - - + +
- + @@ -179,7 +180,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - +

WAITING



-- 
2.34.1