Skip to content

Commit

Permalink
💚 Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed May 30, 2016
1 parent 4b1f4ab commit 18d8e34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
19 changes: 11 additions & 8 deletions spec/helpers/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
`

Expand Down
8 changes: 5 additions & 3 deletions spec/minimap-element-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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()))
})
})
Expand Down

0 comments on commit 18d8e34

Please sign in to comment.