summaryrefslogtreecommitdiff
path: root/lua/tests/automated/scroller_spec.lua
diff options
context:
space:
mode:
authorelianiva <dicha.arkana03@gmail.com>2021-02-24 21:40:11 +0700
committerGitHub <noreply@github.com>2021-02-24 21:40:11 +0700
commit8b3d08d7a6e8eccc2997ccbf91a7e12d506196e5 (patch)
tree46c00cfe4d97351a7c0041e7b17f72fd45def20b /lua/tests/automated/scroller_spec.lua
parentb5051eeb01bfbff2df2b46f59c13318987ed1e59 (diff)
fix: scroll misbehaving + fixed jump to middle (#547)
* fix: scroll misbehaving + fixed jump to middle * add test * fixx * fix nil
Diffstat (limited to 'lua/tests/automated/scroller_spec.lua')
-rw-r--r--lua/tests/automated/scroller_spec.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/lua/tests/automated/scroller_spec.lua b/lua/tests/automated/scroller_spec.lua
index bd202e8..c650aac 100644
--- a/lua/tests/automated/scroller_spec.lua
+++ b/lua/tests/automated/scroller_spec.lua
@@ -114,18 +114,16 @@ describe('scroller', function()
describe('should give top, middle and bottom index', function()
- it('should handle middle index', function()
- eq(5, p_scroller.middle(nil, 11, nil))
- eq(10, p_scroller.middle(nil, 20, nil))
- eq(12, p_scroller.middle(nil, 25, nil))
- end)
-
it('should handle ascending', function()
eq(0, p_scroller.top('ascending', 20, 1000))
eq(19, p_scroller.bottom('ascending', 20, 1000))
eq(0, p_scroller.top('ascending', 20, 10))
eq(9, p_scroller.bottom('ascending', 20, 10))
+
+ eq(5, p_scroller.middle('ascending', 11, 100))
+ eq(10, p_scroller.middle('ascending', 20, 100))
+ eq(12, p_scroller.middle('ascending', 25, 100))
end)
it('should handle descending', function()
@@ -134,6 +132,10 @@ describe('scroller', function()
eq(10, p_scroller.top('descending', 20, 10))
eq(19, p_scroller.bottom('descending', 20, 10))
+
+ eq(25, p_scroller.middle('descending', 30, 10))
+ eq(50, p_scroller.middle('descending', 60, 20))
+ eq(105, p_scroller.middle('descending', 120, 30))
end)
end)
end)