0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

fix unit tests for chrome mobile

This commit is contained in:
Johann-S 2019-04-15 12:00:26 +02:00 committed by XhmikosR
parent 10f91729aa
commit c50c1e9d23
2 changed files with 13 additions and 5 deletions

View File

@ -804,7 +804,7 @@ $(function () {
var $modalBody = $('.modal-body')
$modalBody.scrollTop(100)
assert.strictEqual($modalBody.scrollTop(), 100)
assert.ok($modalBody.scrollTop() > 95 && $modalBody.scrollTop() <= 100)
$modal.on('shown.bs.modal', function () {
assert.strictEqual($modalBody.scrollTop(), 0, 'modal body scrollTop should be 0 when opened')

View File

@ -201,7 +201,9 @@ $(function () {
var done = assert.async()
var testElementIsActiveAfterScroll = function (element, target) {
var deferred = $.Deferred()
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
// add top padding to fix Chrome on Android failures
var paddingTop = 5
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
$content.one('scroll', function () {
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
deferred.resolve()
@ -245,7 +247,9 @@ $(function () {
var done = assert.async()
var testElementIsActiveAfterScroll = function (element, target) {
var deferred = $.Deferred()
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
// add top padding to fix Chrome on Android failures
var paddingTop = 5
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
$content.one('scroll', function () {
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
deferred.resolve()
@ -289,7 +293,9 @@ $(function () {
var done = assert.async()
var testElementIsActiveAfterScroll = function (element, target) {
var deferred = $.Deferred()
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
// add top padding to fix Chrome on Android failures
var paddingTop = 5
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
$content.one('scroll', function () {
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
deferred.resolve()
@ -604,7 +610,9 @@ $(function () {
var testElementIsActiveAfterScroll = function (element, target) {
var deferred = $.Deferred()
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
// add top padding to fix Chrome on Android failures
var paddingTop = 5
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top) + paddingTop
$content.one('scroll', function () {
assert.ok($(element).hasClass('active'), 'target:' + target + ', element: ' + element)
deferred.resolve()