summaryrefslogtreecommitdiff
path: root/spec/frontend/issue_show/index_spec.js
blob: e80d1b83c110207a595f823ab9a7401c0f18d26e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import initIssueableApp from '~/issue_show';

describe('Issue show index', () => {
  describe('initIssueableApp', () => {
    it('should initialize app with no potential XSS attack', () => {
      const d = document.createElement('div');
      d.id = 'js-issuable-app-initial-data';
      d.innerHTML = JSON.stringify({
        initialDescriptionHtml: '<img src=x onerror=alert(1)>',
      });
      document.body.appendChild(d);

      const alertSpy = jest.spyOn(window, 'alert');
      initIssueableApp();

      expect(alertSpy).not.toHaveBeenCalled();
    });
  });
});