Skip to content

Commit dcea89a

Browse files
committed
Update data attribute and test assertion for toast in consent preferences component
1 parent d023b3d commit dcea89a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • src/components/Consent/Preferences/client

‎src/components/Consent/Preferences/client/index.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,15 @@ export class ConsentPreferencesElement extends LitElement {
262262
}
263263

264264
private showNotification(message: string): void {
265+
document
266+
.querySelectorAll<HTMLDivElement>('[data-testid="consent-toast"]')
267+
.forEach((existingToast) => existingToast.remove())
268+
265269
// Create a simple notification
266270
const notification = document.createElement('div')
267271
notification.className =
268272
'fixed top-4 right-4 bg-green-600 text-white px-6 py-3 rounded-lg shadow-lg z-50 transition-all duration-300'
273+
notification.dataset['testid'] = 'consent-toast'
269274
notification.textContent = message
270275

271276
document.body.appendChild(notification)

0 commit comments

Comments
 (0)