mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
use loading indicator
This commit is contained in:
@@ -15,20 +15,26 @@ test.before(() => {
|
||||
})
|
||||
|
||||
test.beforeEach((t) => {
|
||||
t.context.list = document.createElement('ul')
|
||||
t.context.list.setAttribute('data-maximum', '2')
|
||||
const listElement = document.createElement('li')
|
||||
listElement.setAttribute('style', 'display: none;')
|
||||
t.context.list.appendChild(listElement)
|
||||
const listElement2 = document.createElement('li')
|
||||
listElement2.setAttribute('style', 'display: none;')
|
||||
t.context.list.appendChild(listElement2)
|
||||
t.context.container = document.createElement('div')
|
||||
|
||||
const errorMessageGroupNotFound = document.createElement('div')
|
||||
errorMessageGroupNotFound.setAttribute('style', 'display: none;')
|
||||
t.context.container.appendChild(errorMessageGroupNotFound)
|
||||
const errorMessageGeneral = document.createElement('div')
|
||||
errorMessageGeneral.setAttribute('style', 'display: none;')
|
||||
t.context.container.appendChild(errorMessageGeneral)
|
||||
|
||||
const list = document.createElement('ul')
|
||||
list.setAttribute('data-maximum', '2')
|
||||
const loadingMessage = document.createElement('li')
|
||||
list.appendChild(loadingMessage)
|
||||
t.context.container.appendChild(list)
|
||||
})
|
||||
|
||||
// TODO
|
||||
// eslint-disable-next-line ava/no-skip-test
|
||||
test.skip('#displayEvents one event', (t) => {
|
||||
const list = t.context.list
|
||||
const container = t.context.container
|
||||
const data = {
|
||||
events: {
|
||||
elements: [
|
||||
@@ -45,7 +51,8 @@ test.skip('#displayEvents one event', (t) => {
|
||||
],
|
||||
},
|
||||
}
|
||||
displayEvents({ data, document, list })
|
||||
displayEvents({ data, document, container })
|
||||
const list = container.children[2]
|
||||
t.is(list.children.length, 3)
|
||||
t.is(list.children[2].childNodes[0].tagName, 'A')
|
||||
t.is(list.children[2].childNodes[0].getAttribute('href'), 'b')
|
||||
@@ -56,21 +63,22 @@ test.skip('#displayEvents one event', (t) => {
|
||||
t.is(list.children[2].childNodes[4].nodeValue, 'c, d')
|
||||
})
|
||||
|
||||
test('#displayErrorMessage no children added', (t) => {
|
||||
const list = t.context.list
|
||||
displayErrorMessage({ data: '', list })
|
||||
t.is(list.children.length, 2)
|
||||
test('#displayErrorMessage no list entries shown', (t) => {
|
||||
const container = t.context.container
|
||||
const list = container.children[2]
|
||||
displayErrorMessage({ data: '', container })
|
||||
t.is(list.children.length, 0)
|
||||
})
|
||||
|
||||
test('#displayErrorMessage error message display', (t) => {
|
||||
const list = t.context.list
|
||||
displayErrorMessage({ data: '', list })
|
||||
t.is(list.children[0].style.display, 'block')
|
||||
t.is(list.children[1].style.display, 'none')
|
||||
const container = t.context.container
|
||||
displayErrorMessage({ data: '', container })
|
||||
t.is(container.children[0].style.display, 'block')
|
||||
t.is(container.children[1].style.display, 'none')
|
||||
})
|
||||
|
||||
test('#displayErrorMessage group not found error message display', (t) => {
|
||||
const list = t.context.list
|
||||
const container = t.context.container
|
||||
const data = {
|
||||
response: {
|
||||
errors: [
|
||||
@@ -80,7 +88,7 @@ test('#displayErrorMessage group not found error message display', (t) => {
|
||||
],
|
||||
},
|
||||
}
|
||||
displayErrorMessage({ data, list })
|
||||
t.is(list.children[0].style.display, 'none')
|
||||
t.is(list.children[1].style.display, 'block')
|
||||
displayErrorMessage({ data, container })
|
||||
t.is(container.children[0].style.display, 'none')
|
||||
t.is(container.children[1].style.display, 'block')
|
||||
})
|
||||
|
Reference in New Issue
Block a user