       expect(element[0].sheet).toBe stylesheetAddedHandler.argsForCall[0][0]
 
       # doesn't append twice
+      styleElementAddedHandler.reset()
       themeManager.requireStylesheet(cssPath)
       expect($('head style').length).toBe lengthBefore + 1
+      expect(styleElementAddedHandler).not.toHaveBeenCalled()
 
       $('head style[id*="css.css"]').remove()
 

          expect(workspaceElement).not.toHaveClass 'theme-atom-dark-syntax'

  describe "when the user stylesheet changes", ->
    it "reloads it", ->
      [stylesheetRemovedHandler, stylesheetAddedHandler, stylesheetsChangedHandler] = []
      userStylesheetPath = path.join(temp.mkdirSync("atom"), 'styles.less')
      fs.writeFileSync(userStylesheetPath, 'body {border-style: dotted !important;}')

      runs ->
        expect($(document.body).css('border-style')).toBe 'dashed'

        expect(styleElementRemovedHandler).toHaveBeenCalled()
        expect(styleElementRemovedHandler.argsForCall[0][0].textContent).toContain 'dotted'
        expect(stylesheetRemovedHandler).toHaveBeenCalled()
        expect(stylesheetRemovedHandler.argsForCall[0][0].cssRules[0].style.border).toBe 'dotted'

        expect(styleElementAddedHandler).toHaveBeenCalled()
        expect(styleElementAddedHandler.argsForCall[0][0].textContent).toContain 'dashed'
        expect(stylesheetAddedHandler).toHaveBeenCalled()
        expect(stylesheetAddedHandler.argsForCall[0][0].cssRules[0].style.border).toBe 'dashed'

        expect(stylesheetsChangedHandler).toHaveBeenCalled()

        styleElementRemovedHandler.reset()
        stylesheetRemovedHandler.reset()
        stylesheetsChangedHandler.reset()
        fs.removeSync(userStylesheetPath)
