Skip to content

Commit

Permalink
🐛 Fix quick settings position with soft wrap and on left settings
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Feb 11, 2015
1 parent 0d45445 commit 6149566
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class MinimapElement extends HTMLElement
@quickSettingsElement = null

@quickSettingsElement.attach()
{top, left, right} = @getBoundingClientRect()
{top, left, right} = @canvas.getBoundingClientRect()
@quickSettingsElement.style.top = top + 'px'

if @displayMinimapOnLeft
Expand Down
31 changes: 29 additions & 2 deletions spec/minimap-element-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ describe 'MinimapElement', ->
expect(quickSettingsElement).toExist()

it 'positions the quick settings view next to the minimap', ->
minimapBounds = minimapElement.getBoundingClientRect()
minimapBounds = minimapElement.canvas.getBoundingClientRect()
settingsBounds = quickSettingsElement.getBoundingClientRect()

expect(realOffsetTop(quickSettingsElement)).toBeCloseTo(minimapBounds.top, 0)
Expand All @@ -689,12 +689,39 @@ describe 'MinimapElement', ->
minimapElement.quickSettingsElement.destroy()

it 'positions the quick settings view next to the minimap', ->
minimapBounds = minimapElement.getBoundingClientRect()
minimapBounds = minimapElement.canvas.getBoundingClientRect()
settingsBounds = quickSettingsElement.getBoundingClientRect()

expect(realOffsetTop(quickSettingsElement)).toBeCloseTo(minimapBounds.top, 0)
expect(realOffsetLeft(quickSettingsElement)).toBeCloseTo(minimapBounds.right, 0)

describe 'when the adjustMinimapWidthToSoftWrap setting is enabled', ->
describe 'when the displayMinimapOnLeft setting is enabled', ->
describe 'clicking on the div', ->
beforeEach ->
atom.config.set('minimap.adjustMinimapWidthToSoftWrap', true)
atom.config.set('minimap.displayMinimapOnLeft', true)
nextAnimationFrame()

workspaceElement = atom.views.getView(atom.workspace)
jasmineContent.appendChild(workspaceElement)

openQuickSettings = minimapElement.shadowRoot.querySelector('.open-minimap-quick-settings')
mousedown(openQuickSettings)

quickSettingsElement = workspaceElement.querySelector('minimap-quick-settings')

afterEach ->
minimapElement.quickSettingsElement.destroy()

it 'positions the quick settings view next to the minimap', ->
minimapBounds = minimapElement.canvas.getBoundingClientRect()
settingsBounds = quickSettingsElement.getBoundingClientRect()

expect(realOffsetTop(quickSettingsElement)).toBeCloseTo(minimapBounds.top, 0)
expect(realOffsetLeft(quickSettingsElement)).toBeCloseTo(minimapBounds.right, 0)


describe 'when the quick settings view is open', ->
beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
Expand Down

0 comments on commit 6149566

Please sign in to comment.