chore: add tests

pull/6773/head^2
Konstantinos Kaloutas 2022-10-06 13:12:20 +03:00 committed by Andelf
parent f18cc5c6fb
commit a36f56c8df
2 changed files with 21 additions and 9 deletions

View File

@ -0,0 +1,21 @@
import { expect } from '@playwright/test'
import { test } from './fixtures'
import { createRandomPage } from './utils'
test('should not spawn any dialogs', async ({ page, block }) => {
await createRandomPage(page)
page.on('dialog', async dialog => {
expect(false).toBeTruthy()
await dialog.dismiss()
})
await page.keyboard.type('<iframe src="javascript:confirm(1);" />')
await block.enterNext()
await page.keyboard.type('<button id="test-xss-button" onclick="confirm(1)">Click me!</button>')
await block.enterNext()
await page.click('#test-xss-button')
expect(true).toBeTruthy()
})

View File

@ -14,12 +14,3 @@
(defn sanitize-html
[html]
(.sanitize DOMPurify html sanitization-options))
;; HTML:
;; Example 1:
;; <script>
;; alert('gotcha');
;; </script>
;; Example 2:
;; <div style="padding: 20px; opacity: 0;height: 20px;" onmouseout="alert('Gotcha!')"></div>