-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mute_button.html
More file actions
73 lines (66 loc) · 2.48 KB
/
Copy pathtest_mute_button.html
File metadata and controls
73 lines (66 loc) · 2.48 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Mute Button Test</title>
<style>
#mute-button {
width: 50px;
height: 50px;
background-image: url('svg/speaker.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 28px;
border: none;
cursor: pointer;
}
#mute-button.muted {
background-image: url('svg/mute.svg');
}
#test-results {
margin-top: 20px;
padding: 10px;
border: 1px solid #ccc;
max-width: 500px;
}
</style>
</head>
<body>
<h1>Mute Button Icon Test</h1>
<button id="mute-button" class="side-button" title="Mute/Unmute"></button>
<div id="test-results">
<h3>Test Results:</h3>
<p id="initial-state"></p>
<p id="after-toggle"></p>
<p id="localstorage-test"></p>
</div>
<script>
// Test the mute button functionality
document.addEventListener('DOMContentLoaded', function() {
const muteButton = document.getElementById('mute-button');
const initialState = document.getElementById('initial-state');
const afterToggle = document.getElementById('after-toggle');
const localstorageTest = document.getElementById('localstorage-test');
// Test 1: Initial state
initialState.textContent = 'Initial button state: ' + (muteButton.classList.contains('muted') ? 'MUTED' : 'UNMUTED');
// Test 2: Toggle functionality
muteButton.addEventListener('click', function() {
const currentlyMuted = muteButton.classList.contains('muted');
if (currentlyMuted) {
muteButton.classList.remove('muted');
} else {
muteButton.classList.add('muted');
}
afterToggle.textContent = 'After toggle: ' + (muteButton.classList.contains('muted') ? 'MUTED' : 'UNMUTED');
});
// Test 3: LocalStorage test
try {
localStorage.setItem('test', 'value');
localStorage.removeItem('test');
localstorageTest.textContent = 'LocalStorage: WORKING';
} catch (e) {
localstorageTest.textContent = 'LocalStorage: FAILED - ' + e.message;
}
});
</script>
</body>
</html>