<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
<script src="../calendar-picker/resources/calendar-picker-common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<input type="date" id="date">
<script>
description('Test for child elements of a datalist element.');
openPickerDeprecatedJsTest(document.getElementById('date'), test);
function makeRect(x, y, width, height) {
return {
x: x,
y: y,
width: width,
height: height
};
}
function test() {
Object.defineProperty(internals.pagePopupWindow, 'screen', {
value: {
width: 80,
height: 60,
availLeft: 0,
availTop: 0,
availWidth: 80,
availHeight: 60
}
});
debug("Move anchor element along the vertical axis.");
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,-10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,0,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,20,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,30,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 30, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,40,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 40, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,50,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 50, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,40,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 60, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,50,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 70, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,60,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 80, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,70,30,10)');
debug("Move anchor element along the horizontal axis.");
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(-40, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-40,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(-30, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-30,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(-20, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-20,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(-10, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-10,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(10, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(10,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(20, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(20,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(30,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(40, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(40,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(50, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(50,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(60, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(50,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(70, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(60,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(80, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(70,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(90, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(80,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(100, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(90,10,30,10)');
debug("Move anchor element along the vertical axis. Open popup that is too tall.");
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,-10,30,60)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,60)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,10,30,50)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,20,30,40)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,30,30,30)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 30, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,30)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 40, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,40)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 50, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,50)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 60, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,60)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 70, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,10,30,60)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 80, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,20,30,60)');
debug("Move anchor element along the vertical axis. Open popup that is too tall and won't shrink.");
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-10,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, -10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,0,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,10,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 10, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,20,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 20, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,30,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 30, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-970,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 40, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-960,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 50, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-950,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 60, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-940,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 70, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-930,30,1000)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(0, 80, 20, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-920,30,1000)');
debug("Grow popup width.");
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(30,10,30,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(40, 10, 40, 10).toString()', 'Rectangle(30,10,40,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(50, 10, 50, 10).toString()', 'Rectangle(30,10,50,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(60, 10, 60, 10).toString()', 'Rectangle(0,10,60,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(70, 10, 70, 10).toString()', 'Rectangle(30,10,70,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(80, 10, 80, 10).toString()', 'Rectangle(30,10,80,10)');
internals.pagePopupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
shouldBeEqualToString('internals.pagePopupWindow.adjustWindowRect(90, 10, 90, 10).toString()', 'Rectangle(30,10,90,10)');
finishJSTest();
}
</script>
</body>
</html>