2018-08-23 20:53:35 +00:00
|
|
|
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);
|
|
|
|
|
2019-12-20 15:07:34 +00:00
|
|
|
const alertSpy = jest.spyOn(window, 'alert');
|
2018-08-23 20:53:35 +00:00
|
|
|
initIssueableApp();
|
|
|
|
|
|
|
|
expect(alertSpy).not.toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|