File size: 2,642 Bytes
a85611d |
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
document.addEventListener('DOMContentLoaded', function() {
// Initialize tooltips
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
// Toggle mobile menu
const mobileMenuButton = document.getElementById('mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
if(mobileMenuButton && mobileMenu) {
mobileMenuButton.addEventListener('click', function() {
mobileMenu.classList.toggle('hidden');
});
}
// Sample data for charts (would be replaced with real data in production)
const testStatusData = {
labels: ['Passed', 'Failed', 'Pending'],
datasets: [{
data: [124, 8, 32],
backgroundColor: [
'#10B981',
'#EF4444',
'#F59E0B'
],
hoverOffset: 4
}]
};
// Initialize charts (example with Chart.js)
if(typeof Chart !== 'undefined') {
const ctx = document.getElementById('testStatusChart');
if(ctx) {
new Chart(ctx, {
type: 'doughnut',
data: testStatusData,
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom',
}
}
}
});
}
}
// Filter functionality for test cases
const filterButtons = document.querySelectorAll('.filter-btn');
const testCaseRows = document.querySelectorAll('tbody tr');
filterButtons.forEach(button => {
button.addEventListener('click', function() {
const filterValue = this.getAttribute('data-filter');
testCaseRows.forEach(row => {
if(filterValue === 'all') {
row.style.display = '';
} else {
const rowType = row.querySelector('td:nth-child(3) span').textContent.toLowerCase();
if(rowType.includes(filterValue)) {
row.style.display = '';
} else {
row.style.display = 'none';
}
}
});
// Update active button
filterButtons.forEach(btn => btn.classList.remove('active'));
this.classList.add('active');
});
});
}); |