From 4f0e3fdf852960752439d3b78d49ea2450c43a5e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 31 May 2016 16:21:40 -0700 Subject: [PATCH] [Timeline] Test zoom controller's width --- .../controllers/TimelineZoomControllerSpec.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js index bf87d17916..9e67eecc3f 100644 --- a/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js +++ b/platform/features/timeline/test/controllers/TimelineZoomControllerSpec.js @@ -119,6 +119,27 @@ define( expect(Math.round(controller.toMillis(x2))) .toBeGreaterThan(testEnd); }); + + it("provides a width which is not less than scroll area width", function () { + var testPixel = mockScope.scroll.width / 4, + testMillis = controller.toMillis(testPixel); + expect(controller.width(testMillis)) + .toEqual(mockScope.scroll.width); + }); + + it("provides a width with some margin past timestamp", function () { + var testPixel = mockScope.scroll.width * 4, + testMillis = controller.toMillis(testPixel); + expect(controller.width(testMillis)) + .toBeGreaterThan(controller.toPixels(testMillis)); + }); + + it("provides a width which does not greatly exceed timestamp", function () { + var testPixel = mockScope.scroll.width * 4, + testMillis = controller.toMillis(testPixel); + expect(controller.width(testMillis)) + .toBeLessThan(controller.toPixels(testMillis * 2)); + }); }); });