     describe 'clicking on a header cell edit action button', ->
       [editor, editorElement, cell, cellOffset] = []
 
+      startHeaderCellEdit = (selector) ->
+        cell = header.querySelector(selector)
+        action = cell.querySelector('.column-edit-action')
+        cellOffset = cell.getBoundingClientRect()
+
+        click(action)
+
+        editorElement = tableElement.querySelector('atom-text-editor')
+        editor = editorElement.model
+
+      confirmHeaderCellEdit = (value='') ->
+        editor.setText(value)
+        atom.commands.dispatch(editorElement, 'core:confirm')
+
+      editHeaderCell = (selector, value) ->
+        startHeaderCellEdit(selector)
+        confirmHeaderCellEdit(value)
+
       describe 'that does not have a name', ->
         beforeEach ->
           tableEditor.insertColumnBefore()
           nextAnimationFrame()
 
-          cell = header.querySelector('tablr-header-cell')
-          action = cell.querySelector('.column-edit-action')
-          cellOffset = cell.getBoundingClientRect()
-
-          click(action)
-
-          editorElement = tableElement.querySelector('atom-text-editor')
-          editor = editorElement.model
+          startHeaderCellEdit('tablr-header-cell')
 
         it 'opens the editor with the dynamic name as content', ->
           expect(editor.getText()).toEqual('A')


          describe 'when the editor is empty', ->
            it 'does not change the cell value', ->
              editor.setText('')
              atom.commands.dispatch(editorElement, 'core:confirm')
              expect(tableEditor.getScreenColumn(0).name).toEqual(undefined)

      describe 'that have a name', ->
        beforeEach ->

    TableSelectionElement.registerViewProvider()
    TableElement.registerCommands()

    jasmineContent = document.body#.querySelector('#jasmine-content')

    spyOn(window, "setInterval").andCallFake window.fakeSetInterval
    spyOn(window, "clearInterval").andCallFake window.fakeClearInterval
