mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
add unit test for affix-top for padding issue
This commit is contained in:
parent
423825f506
commit
da79ab9488
@ -68,4 +68,33 @@ $(function () {
|
||||
}, 16) // for testing in a browser
|
||||
}, 0)
|
||||
})
|
||||
|
||||
test('should affix-top when scrolling up to offset when parent has padding', function () {
|
||||
stop()
|
||||
|
||||
var templateHTML = '<div id="padding-offset" style="padding-top: 20px;">'
|
||||
+ '<div id="affixTopTarget">'
|
||||
+ '<p>Testing affix-top class is added</p>'
|
||||
+ '</div>'
|
||||
+ '<div style="height: 1000px; display: block;"/>'
|
||||
+ '</div>'
|
||||
$(templateHTML).appendTo(document.body)
|
||||
|
||||
$('#affixTopTarget')
|
||||
.bootstrapAffix({
|
||||
offset: { top: 120, bottom: 0 }
|
||||
})
|
||||
.on('affixed-top.bs.affix', function () {
|
||||
ok($('#affixTopTarget').hasClass('affix-top'), 'affix-top class applied')
|
||||
start()
|
||||
})
|
||||
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
|
||||
setTimeout(function () {
|
||||
window.scroll(0, 119)
|
||||
}, 250)
|
||||
}, 250)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user