From 0ebd39e80f3726edaf93ecbc1a92bc33a3679572 Mon Sep 17 00:00:00 2001 From: Jason Stallings Date: Sun, 25 Feb 2018 14:06:15 -0600 Subject: [PATCH] horizontal scroll test. --- test/integration/mouse.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/integration/mouse.js b/test/integration/mouse.js index 6385631c..a536ca09 100644 --- a/test/integration/mouse.js +++ b/test/integration/mouse.js @@ -37,7 +37,7 @@ describe('Integration/Mouse', () => { robot.mouseClick(); }); - it('scrolls', done => { + it('scrolls vertically', done => { target.once('scroll', element => { /** * TODO: This is gross! The scroll distance is different for each OS. I want @@ -64,4 +64,32 @@ describe('Integration/Mouse', () => { robot.mouseClick(); robot.scrollMouse(0, -10); }); + + it('scrolls horizontally', done => { + target.once('scroll', element => { + /** + * TODO: This is gross! The scroll distance is different for each OS. I want + * to look into this further, but at least these numbers are consistent. + */ + var expectedScroll; + switch(os.platform()) { + case 'linux': + expectedScroll = 530; + break; + case 'win32': + expectedScroll = 8; + break; + default: + expectedScroll = 10; + } + expect(element.id).toEqual('textarea_1'); + expect(element.scroll_x).toEqual(expectedScroll); + done(); + }); + + var textarea_1 = elements.textarea_1; + robot.moveMouse(textarea_1.x, textarea_1.y); + robot.mouseClick(); + robot.scrollMouse(-10, 0); + }); });