mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-17 19:21:23 +03:00
fix unit tests
This commit is contained in:
+1
-16
@@ -26,7 +26,7 @@ $(function () {
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
var $el = $('<div/>').appendTo('#qunit-fixture')
|
||||
var $affix = $el.bootstrapAffix()
|
||||
assert.ok($affix instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($affix[0], $el[0], 'collection contains element')
|
||||
@@ -104,19 +104,4 @@ $(function () {
|
||||
}, 250)
|
||||
}, 250)
|
||||
})
|
||||
|
||||
QUnit.test('should raise exception to avoid xss on target', function (assert) {
|
||||
assert.expect(1)
|
||||
assert.throws(function () {
|
||||
|
||||
var templateHTML = '<div id="affixTarget"></div>'
|
||||
$(templateHTML).appendTo(document.body)
|
||||
|
||||
$('#affixTarget').bootstrapAffix({
|
||||
target: '<img src=1 onerror=\'alert(0)\'>'
|
||||
})
|
||||
|
||||
}, new Error('Syntax error, unrecognized expression: <img src=1 onerror=\'alert(0)\'>'))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user