Reset view registry in AtomEnvironment::reset

This commit is contained in:
Nathan Sobo
2015-10-06 10:55:12 -06:00
parent 097a035dc4
commit b7d6dd5e8c
3 changed files with 13 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ describe "TextEditorComponent", ->
nextAnimationFrame = noAnimationFrame
spyOn(window, 'requestAnimationFrame').andCallFake (fn) ->
debugger if global.debug
nextAnimationFrame = ->
nextAnimationFrame = noAnimationFrame
fn()
@@ -54,6 +55,10 @@ describe "TextEditorComponent", ->
component.measureDimensions()
nextAnimationFrame()
# Mutating the DOM in the previous frame causes a document poll; clear it here
waits 0
runs -> nextAnimationFrame()
afterEach ->
contentNode.style.width = ''

View File

@@ -226,6 +226,9 @@ class AtomEnvironment extends Model
@deserializers.clear()
@registerDefaultDeserializers()
@views.clear()
@registerDefaultViewProviders()
@config.clear()
@setConfigSchema()

View File

@@ -50,14 +50,14 @@ class ViewRegistry
minimumPollInterval: 200
constructor: (@atomEnvironment) ->
@observer = new MutationObserver(@requestDocumentPoll)
@clear()
clear: ->
@views = new WeakMap
@providers = []
@documentWriters = []
@documentReaders = []
@documentPollers = []
@observer = new MutationObserver(@requestDocumentPoll)
@debouncedPerformDocumentPoll = _.throttle(@performDocumentPoll, @minimumPollInterval).bind(this)
@clearDocumentRequests()
# Essential: Add a provider that will be used to construct views in the
# workspace's view layer based on model objects in its model layer.