From ac1cc87037230cb632e842e0f824366feb17c827 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 9 Feb 2015 09:35:38 -0800 Subject: [PATCH] Use custom document to create test elements --- src/menu-manager.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index c9daf76d1..1991cba95 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -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)