tDiv.clientWidth / 2);

var expectedYTop = 4000;
var expectedYBottom = 4000 - window.innerHeight + testDiv.clientHeight;
var expectedYCenter = 4000 - (window.innerHeight / 2) + (testDiv.clientHeight / 2);

[
  ["omitted argument", "nearest", expectedYTop],
  [true, "nearest", expectedYTop],
  [false, "nearest", expectedYBottom],
  [undefined, "nearest", expectedYTop],
  [null, "nearest", expectedYTop],
  [{}, "nearest", expectedYTop],
  [{block: "center", inline: "center"}, expectedXCenter, expectedYCenter]