Path:
strictdoc/export/html/_static/traceability_matrix_screen.js
Lines:
49
Non-empty lines:
40
Non-empty lines covered with requirements:
40 / 40 (100.0%)
Functions:
0
Functions covered by requirements:
0 / 0 (0.0%)
1
// @relation(SDOC-SRS-112, scope=file)2
3
(function () {
4
const SELECTOR = '[js-requirements-coverage]';
5
6
const __log = (topic, ...payload) => {
7
console.log(`%c ${topic} `, 'background:yellow;color:black',
8
...payload
9
);
10
}11
12
function markSame(newUid, state, arr) {
13
// __log('state', state.currentUid);
14
state.currentUid && arr[state.currentUid].forEach(element => element.classList.remove('highlighted'));
15
state.currentUid = newUid;
16
arr[newUid].forEach(element => element.classList.add('highlighted'));
17
18
}19
20
window.addEventListener("load", function () {
21
// __log(
22
// 'requirements-coverage',
23
// 'test'
24
// )
25
26
const state = {
27
currentUid: null
28
}
29
30
const reqs = [...document.querySelectorAll(SELECTOR)]
31
.reduce((acc, req) => {
32
if (req.hasAttribute('data-uid')) {
33
const uid = req.dataset.uid;
34
req.addEventListener('click', () => markSame(uid, state, reqs));
35
acc[uid] = acc[uid] ? [...acc[uid], req] : [req];
36
} else {
37
req.classList.add('nouid')
38
acc.nouid.push(req);
39
}
40
return acc
41
}, { nouid: [] });
42
43
// __log(
44
// '--',
45
// reqs
46
// )
47
48
});49
})();