From 18d8e34c11e1cf3aeb220793342b410c8f9220f6 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 30 May 2016 11:57:24 +0200 Subject: [PATCH] :green_heart: Fix broken tests --- spec/helpers/workspace.js | 19 +++++++++++-------- spec/minimap-element-spec.js | 8 +++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/spec/helpers/workspace.js b/spec/helpers/workspace.js index 2dc8af3d..766f86b7 100644 --- a/spec/helpers/workspace.js +++ b/spec/helpers/workspace.js @@ -19,31 +19,34 @@ beforeEach(() => { let styleNode = document.createElement('style') styleNode.textContent = ` ${stylesheet} + atom-text-editor { + position: relative; + } atom-text-editor-minimap[stand-alone] { - width: 100px - height: 100px + width: 100px; + height: 100px; } atom-text-editor, atom-text-editor::shadow { - line-height: 17px + line-height: 17px; } atom-text-editor atom-text-editor-minimap, atom-text-editor::shadow atom-text-editor-minimap { - background: rgba(255,0,0,0.3) + background: rgba(255,0,0,0.3); } atom-text-editor atom-text-editor-minimap::shadow .minimap-scroll-indicator, atom-text-editor::shadow atom-text-editor-minimap::shadow .minimap-scroll-indicator { - background: rgba(0,0,255,0.3) + background: rgba(0,0,255,0.3); } atom-text-editor atom-text-editor-minimap::shadow .minimap-visible-area, atom-text-editor::shadow atom-text-editor-minimap::shadow .minimap-visible-area { - background: rgba(0,255,0,0.3) - opacity: 1 + background: rgba(0,255,0,0.3); + opacity: 1; } atom-text-editor::shadow atom-text-editor-minimap::shadow .open-minimap-quick-settings { - opacity: 1 !important + opacity: 1 !important; } ` diff --git a/spec/minimap-element-spec.js b/spec/minimap-element-spec.js index 0921ebd2..10464be4 100644 --- a/spec/minimap-element-spec.js +++ b/spec/minimap-element-spec.js @@ -246,13 +246,15 @@ describe('MinimapElement', () => { }) it('sets the visible area width and height', () => { - expect(visibleArea.offsetWidth).toEqual(minimapElement.clientWidth) + expect(visibleArea.offsetWidth).toEqual(minimapElement.clientWidth + Math.floor(minimap.getTextEditorScaledScrollLeft())) expect(visibleArea.offsetHeight).toBeCloseTo(minimap.getTextEditorScaledHeight(), 0) }) it('sets the visible visible area offset', () => { expect(realOffsetTop(visibleArea)).toBeCloseTo(minimap.getTextEditorScaledScrollTop() - minimap.getScrollTop(), 0) - expect(realOffsetLeft(visibleArea)).toBeCloseTo(minimap.getTextEditorScaledScrollLeft(), 0) + + expect(Math.floor(parseFloat(visibleArea.style.borderLeftWidth))) + .toEqual(Math.floor(minimap.getTextEditorScaledScrollLeft())) }) it('offsets the canvas when the scroll does not match line height', () => { @@ -480,7 +482,7 @@ describe('MinimapElement', () => { it('updates the visible area', () => { expect(realOffsetTop(visibleArea)).toBeCloseTo(minimap.getTextEditorScaledScrollTop() - minimap.getScrollTop(), 0) - expect(parseFloat(visibleArea.style.borderLeftWidth)) + expect(Math.floor(parseFloat(visibleArea.style.borderLeftWidth))) .toEqual(Math.floor(minimap.getTextEditorScaledScrollLeft())) }) })