mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 14:31:02 +00:00 
			
		
		
		
	Fixes https://github.com/go-gitea/gitea/issues/24353 In some case like async success/error, it is useful to show toasts in UI.
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			587 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			587 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import {test, expect} from 'vitest';
 | |
| import {showInfoToast, showErrorToast, showWarningToast} from './toast.js';
 | |
| 
 | |
| test('showInfoToast', async () => {
 | |
|   await showInfoToast('success 😀', {duration: -1});
 | |
|   expect(document.querySelector('.toastify')).toBeTruthy();
 | |
| });
 | |
| 
 | |
| test('showWarningToast', async () => {
 | |
|   await showWarningToast('warning 😐', {duration: -1});
 | |
|   expect(document.querySelector('.toastify')).toBeTruthy();
 | |
| });
 | |
| 
 | |
| test('showErrorToast', async () => {
 | |
|   await showErrorToast('error 🙁', {duration: -1});
 | |
|   expect(document.querySelector('.toastify')).toBeTruthy();
 | |
| });
 |