diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index 87c2d8fb..c8494619 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -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 = -> diff --git a/spec/minimap-element-spec.coffee b/spec/minimap-element-spec.coffee index d2fa45d7..88d26f9e 100644 --- a/spec/minimap-element-spec.coffee +++ b/spec/minimap-element-spec.coffee @@ -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()