-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
52 lines (49 loc) · 1.65 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const pageConfig = [
{
type: 'LikeShop Embed',
tests: [],
},
{
type: 'LikeShop Carousel',
tests: [],
},
{
type: 'Gallery Embed',
tests: [],
},
{
type: 'Gallery Carousel',
tests: [
{ name: 'Base - DEV', url: '/spirit-galleries/gallery-carousel/dev.html'},
{ name: 'Override - DEV', url: '/spirit-galleries/gallery-carousel/dev-override.html'},
{ name: 'Base - PROD', url: '/spirit-galleries/gallery-carousel/prod.html'},
{ name: 'Override - PROD', url: '/spirit-galleries/gallery-carousel/prod-override.html'},
],
},
{
type: 'Product Carousel',
tests: [
{ name: 'Base - DEV', url: '/spirit-galleries/product-carousel/dev.html'},
{ name: 'Override - DEV', url: '/spirit-galleries/product-carousel/dev-override.html'},
{ name: 'Base - PROD', url: '/spirit-galleries/product-carousel/prod.html'},
{ name: 'Override - PROD', url: '/spirit-galleries/product-carousel/prod-override.html'},
],
},
]
function renderRow(elList, name, href) {
const elItem = document.createElement('li')
const elAnchor = document.createElement('a')
elAnchor.innerText = name
elAnchor.href = href
elItem.appendChild(elAnchor)
elList.appendChild(elItem)
}
function renderTableRows() {
const table = document.getElementById('index')
pageConfig.forEach((page) => {
page.tests?.forEach((test) => {
renderRow(table, `${page.type} - ${test.name}`, test.url)
})
})
}
document.addEventListener("DOMContentLoaded", renderTableRows);