mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Use custom document to create test elements
This commit is contained in:
@@ -109,17 +109,20 @@ class MenuManager
|
||||
# Simulate an atom-text-editor element attached to a atom-workspace element attached
|
||||
# to a body element that has the same classes as the current body element.
|
||||
unless @testEditor?
|
||||
testBody = document.createElement('body')
|
||||
# Use new document so that custom elements don't actually get created
|
||||
testDocument = document.implementation.createDocument(document.namespaceURI, 'html')
|
||||
|
||||
testBody = testDocument.createElement('body')
|
||||
testBody.classList.add(@classesForElement(document.body)...)
|
||||
|
||||
testWorkspace = document.createElement('atom-workspace')
|
||||
testWorkspace = testDocument.createElement('atom-workspace')
|
||||
workspaceClasses = @classesForElement(document.body.querySelector('atom-workspace'))
|
||||
workspaceClasses = ['workspace'] if workspaceClasses.length is 0
|
||||
testWorkspace.classList.add(workspaceClasses...)
|
||||
|
||||
testBody.appendChild(testWorkspace)
|
||||
|
||||
@testEditor = document.createElement('atom-text-editor')
|
||||
@testEditor = testDocument.createElement('atom-text-editor')
|
||||
@testEditor.classList.add('editor')
|
||||
testWorkspace.appendChild(@testEditor)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user