mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 17:20:22 +00:00

Writing a sample Javascript driver pointed out some extra whitespace handling that needed to be done in the diff driver. This adds some tests with some sample javascript code that I pulled off of GitHub just to see what would happen. Also, to clean up the userdiff test data, I did a "git gc" and packed up the test objects.
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
diff --git a/files/file.javascript b/files/file.javascript
|
|
index b9f1286..7cd3c5a 100644
|
|
--- a/files/file.javascript
|
|
+++ b/files/file.javascript
|
|
@@ -16,3 +16,4 @@ function getViewportH ()
|
|
var client = docElem['clientHeight'],
|
|
- inner = window['innerHeight'];
|
|
+ inner = window['innerHeight'],
|
|
+ sample = window['otherProperty'];
|
|
|
|
@@ -27,3 +28,3 @@ function getOffset (el)
|
|
if (!isNaN(el.offsetTop)) {
|
|
- offsetTop += el.offsetTop;
|
|
+ offsetTop += el.offsetTop + 1;
|
|
}
|
|
@@ -43,8 +44,7 @@ function isElementInViewport (el, h)
|
|
viewed = scrolled + getViewportH(),
|
|
- elH = el.offsetHeight,
|
|
elTop = getOffset(el).top,
|
|
- elBottom = elTop + elH,
|
|
+ elBottom = elTop + el.offsetHeight,
|
|
h = h || 0;
|
|
|
|
- return (elTop + elH * h) <= viewed && (elBottom) >= scrolled;
|
|
+ return (elTop + el.offsetHeight * h) <= viewed && (elBottom) >= scrolled;
|
|
}
|
|
@@ -60,4 +60,2 @@ _init: function ()
|
|
|
|
- // Initialize all scrollreveals, triggering all
|
|
- // reveals on visible elements.
|
|
this.elems.forEach(function (el, i) {
|
|
@@ -71,3 +69,3 @@ var scrollHandler = function ()
|
|
self._scrollPage();
|
|
- }, 60);
|
|
+ }, 61);
|
|
}
|
|
@@ -101,2 +99,3 @@ _scrollPage: function ()
|
|
this.scrolled = false;
|
|
+ this.tested = true;
|
|
},
|