Skip to content

Commit 78f2052

Browse files
committed
feat(options): show cancel button when adding
1 parent 4cd3486 commit 78f2052

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

options/options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ if (importWebhooksBtn && importWebhooksInput) {
134134
showAddWebhookBtn.addEventListener('click', () => {
135135
form.classList.remove('hidden');
136136
showAddWebhookBtn.classList.add('hidden');
137+
cancelEditBtn.classList.remove('hidden');
137138
labelInput.focus();
138139
});
139140

tests/options.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,13 @@ describe('options page', () => {
226226
expect(document.getElementById('add-new-webhook-btn').classList.contains('hidden')).toBe(true);
227227
expect(document.getElementById('add-webhook-form').classList.contains('hidden')).toBe(false);
228228
});
229+
230+
test('add new webhook shows cancel button', async () => {
231+
const addBtn = document.getElementById('add-new-webhook-btn');
232+
addBtn.click();
233+
234+
expect(document.getElementById('cancel-edit-btn').classList.contains('hidden')).toBe(false);
235+
expect(document.getElementById('add-webhook-form').classList.contains('hidden')).toBe(false);
236+
expect(document.getElementById('add-new-webhook-btn').classList.contains('hidden')).toBe(true);
237+
});
229238
});

0 commit comments

Comments
 (0)