code.gitea.io/gitea@v1.21.7/web_src/js/bootstrap.test.js (about) 1 import {showGlobalErrorMessage} from './bootstrap.js'; 2 3 test('showGlobalErrorMessage', () => { 4 document.body.innerHTML = '<div class="page-content"></div>'; 5 showGlobalErrorMessage('test msg 1'); 6 showGlobalErrorMessage('test msg 2'); 7 showGlobalErrorMessage('test msg 1'); // duplicated 8 9 expect(document.body.innerHTML).toContain('>test msg 1 (2)<'); 10 expect(document.body.innerHTML).toContain('>test msg 2<'); 11 expect(document.querySelectorAll('.js-global-error').length).toEqual(2); 12 });