Skip to content

Commit

Permalink
Add basic content in minimap element
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Dec 14, 2014
1 parent d1e95aa commit 8a8869d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ class MinimapElement extends HTMLElement

attributeChangedCallback: (attrName, oldValue, newValue) ->

setModel: (model) ->
getModel: -> @minimap

setModel: (@minimap) -> @minimap

initializeContent: ->
@shadowRoot = @createShadowRoot()

@canvas = document.createElement('canvas')
@shadowRoot.appendChild(@canvas)

@visibleArea = document.createElement('div')
@visibleArea.classList.add('minimap-visible-area')
@shadowRoot.appendChild(@visibleArea)

module.exports = MinimapElement = document.registerElement 'atom-text-editor-minimap', prototype: MinimapElement.prototype

MinimapElement.registerViewProvider = ->
Expand Down
9 changes: 9 additions & 0 deletions spec/minimap-element-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ describe 'MinimapElement', ->

it 'has been registered in the view registry', ->
expect(minimapElement).toExist()

it 'has stored the minimap as its model', ->
expect(minimapElement.getModel()).toBe(minimap)

it 'has a canvas in a shadow DOM', ->
expect(minimapElement.shadowRoot.querySelector('canvas')).toExist()

it 'has a div representing the visible area', ->
expect(minimapElement.shadowRoot.querySelector('.minimap-visible-area')).toExist()

0 comments on commit 8a8869d

Please sign in to comment.