     values(editor.decorationsStateForScreenRowRange(0, editor.getLastScreenRow()))
       .filter (decoration) -> decoration.properties.class is 'bookmarked'
       .map (decoration) -> decoration.screenRange
+
+  getBookmarkedLineNodes = (editorElement) ->
+    # TODO: Remove this after light DOM for editors ships on stable.
+    if editorElement.lightDOM
+      editorElement.querySelectorAll('.bookmarked')
+    else
+      editorElement.shadowRoot.querySelectorAll('.bookmarked')
 
   beforeEach ->
     spyOn(window, 'setImmediate').andCallFake (fn) -> fn()

        atom.commands.dispatch editorElement, 'bookmarks:toggle-bookmark'

      waitsFor ->
        editorElement.shadowRoot.querySelectorAll('.bookmarked').length is 0

    it "clears all bookmarks", ->
      editor.setCursorBufferPosition([3, 10])
      atom.commands.dispatch editorElement, 'bookmarks:toggle-bookmark'

      waitsFor ->
        editorElement.shadowRoot.querySelectorAll('.bookmarked').length is 1

      runs ->
        editor.setCursorBufferPosition([5, 0])
        atom.commands.dispatch editorElement, 'bookmarks:toggle-bookmark'

      waitsFor ->
        editorElement.shadowRoot.querySelectorAll('.bookmarked').length is 2

      runs ->
        atom.commands.dispatch editorElement, 'bookmarks:clear-bookmarks'

      waitsFor ->
        editorElement.shadowRoot.querySelectorAll('.bookmarked').length is 0

  describe "when a bookmark is invalidated", ->
    it "creates a marker when toggled", ->


    it "toggles proper classes on proper gutter row", ->
      editor.setCursorBufferPosition([3, 10])
      expect(getBookmarkedLineNodes(editorElement).length).toBe 0

      atom.commands.dispatch editorElement, 'bookmarks:toggle-bookmark'
      lines = []

      waitsFor ->
        lines = getBookmarkedLineNodes(editorElement)
        lines.length is 1

      runs ->
