No al cierre de webs
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 function addVariable() {2  const name = document.getElementById('variable-name').value;3  const value = document.getElementById('variable-value').value;4  const list = document.getElementById('variables-list');5  6  if (name && value) {7  const li = document.createElement('li');8  li.textContent = `${name} = ${value}`;9  li.classList.add('p-2', 'bg-gray-100', 'border', 'border-gray-300', 'rounded');10  list.appendChild(li);11 12  document.getElementById('variable-name').value = '';13  document.getElementById('variable-value').value = '';14  }15 }16 17 function addRequest() {18  const method = document.getElementById('http-method').value;19  const url = document.getElementById('api-url').value;20  const headers = document.getElementById('headers').value;21  const body = document.getElementById('request-body').value;22  const list = document.getElementById('requests-list');23  24  if (method && url) {25  const li = document.createElement('li');26  li.innerHTML = `<strong>${method}</strong> ${url} <br> <em>Headers:</em> ${headers} <br> <em>Body:</em> ${body}`;27  li.classList.add('p-2', 'bg-gray-100', 'border', 'border-gray-300', 'rounded');28  list.appendChild(li);29 30  document.getElementById('api-url').value = '';31  document.getElementById('headers').value = '';32  document.getElementById('request-body').value = '';33  }34 }35 36 function addAssertion() {37  const expression = document.getElementById('assertion-expression').value;38  const list = document.getElementById('assertions-list');39  40  if (expression) {41  const li = document.createElement('li');42  li.textContent = expression;43  li.classList.add('p-2', 'bg-gray-100', 'border', 'border-gray-300', 'rounded');44  list.appendChild(li);45 46  document.getElementById('assertion-expression').value = '';47  }48 }49 50 function saveTest() {51  alert('Test saved!');52 }53 
Enlace
El enlace para compartir es: