2 "This tests that negative scrollTop and scrollLeft values are clamped to zero."
5 var scroller
= document
.createElement('div');
6 scroller
.id
= 'scroller';
7 scroller
.style
.overflow
= 'scroll';
8 scroller
.style
.width
= '200px';
9 scroller
.style
.height
= '200px';
11 var contents
= document
.createElement('div');
12 contents
.style
.width
= '400px';
13 contents
.style
.height
= '400px';
15 scroller
.appendChild(contents
);
16 document
.body
.appendChild(scroller
);
18 function attemptScroll(x
, y
)
20 scroller
.scrollTop
= x
;
21 scroller
.scrollLeft
= y
;
22 return scroller
.scrollTop
+ ',' + scroller
.scrollLeft
;
25 shouldBe("attemptScroll(0, 0)", "'0,0'");
26 shouldBe("attemptScroll(50, 50)", "'50,50'");
27 shouldBe("attemptScroll(-50, -50)", "'0,0'");