This commit is contained in:
Sam Thorogood 2017-01-23 12:30:17 +11:00
Родитель 39d967c067
Коммит 3116dc5386
1 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -236,6 +236,22 @@ void function() {
window.scrollTo(pX, pY);
}
});
test('clamped to top of page', function() {
var big = cleanup(document.createElement('div'));
big.style.height = '200vh'; // 2x view height
document.body.appendChild(big);
document.documentElement.scrollTop = document.documentElement.scrollHeight / 2;
dialog.style.height = document.documentElement.scrollHeight + 200 + 'px';
dialog.showModal();
var visibleRect = dialog.getBoundingClientRect();
assert.equal(visibleRect.top, 0, 'large dialog should be visible at top of page');
var style = window.getComputedStyle(dialog);
assert.equal(style.top, document.documentElement.scrollTop + 'px',
'large dialog should be absolutely positioned at scroll top');
});
});
suite('backdrop', function() {
@ -266,22 +282,6 @@ void function() {
backdrop.click();
assert.equal(clickFired, 1);
});
test('clamped to top of page', function() {
var big = cleanup(document.createElement('div'));
big.style.height = '200vh'; // 2x view height
document.body.appendChild(big);
document.documentElement.scrollTop = document.documentElement.scrollHeight / 2;
dialog.style.height = document.documentElement.scrollHeight + 200 + 'px';
dialog.showModal();
var visibleRect = dialog.getBoundingClientRect();
assert.equal(visibleRect.top, 0, 'large dialog should be visible at top of page');
var style = window.getComputedStyle(dialog);
assert.equal(style.top, document.documentElement.scrollTop + 'px',
'large dialog should be absolutely positioned at scroll top');
});
});
suite('form focus', function() {