mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 21:52:43 +00:00
Add missing test
This commit is contained in:
@@ -4,6 +4,17 @@ require('jsdom-global')();
|
|||||||
|
|
||||||
import { safeHTML } from '../../client/homebrew/brewRenderer/safeHTML';
|
import { safeHTML } from '../../client/homebrew/brewRenderer/safeHTML';
|
||||||
|
|
||||||
|
test('Exit if no document', function() {
|
||||||
|
const doc = document;
|
||||||
|
document = undefined;
|
||||||
|
|
||||||
|
const result = safeHTML('');
|
||||||
|
|
||||||
|
document = doc;
|
||||||
|
|
||||||
|
expect(result).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
test('Javascript via href', function() {
|
test('Javascript via href', function() {
|
||||||
const source = `<a href="javascript:alert('This is a JavaScript injection via href attribute')">Click me</a>`;
|
const source = `<a href="javascript:alert('This is a JavaScript injection via href attribute')">Click me</a>`;
|
||||||
const rendered = safeHTML(source);
|
const rendered = safeHTML(source);
|
||||||
|
|||||||
Reference in New Issue
Block a user