summaryrefslogtreecommitdiffstats
path: root/web_src/js/bootstrap.test.js
blob: a6b901b92c2303e354049e11eb6f4292966ff325 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import {showGlobalErrorMessage} from './bootstrap.js';

test('showGlobalErrorMessage', () => {
  document.body.innerHTML = '<div class="page-content"></div>';
  showGlobalErrorMessage('test msg 1');
  showGlobalErrorMessage('test msg 2');
  showGlobalErrorMessage('test msg 1'); // duplicated

  expect(document.body.innerHTML).toContain('>test msg 1 (2)<');
  expect(document.body.innerHTML).toContain('>test msg 2<');
  expect(document.querySelectorAll('.js-global-error').length).toEqual(2);
});