 PaneAxis = require '../src/pane-axis'
 
 describe "PaneResizeHandleElement", ->
-  describe "as children of PaneAxisElement", ->
+  describe "when add or remove panes in PaneAxisElement", ->
     [paneAxisElement, paneAxis] = []
 
     beforeEach ->

      paneAxisElement.initialize(paneAxis)
      document.querySelector('#jasmine-content').appendChild(paneAxisElement)

    it "inserts or remove resize elements when pane axis added or removed", ->
      modelChildren = (new PaneAxis({}) for i in [1..5])
      paneAxis.addChild(modelChildren[0])
      paneAxis.addChild(modelChildren[1])

      expectPaneAxisElement = (index) ->
        child = paneAxisElement.children[index]
        expect(child.nodeName.toLowerCase()).toBe('atom-pane-axis')

      expectResizeElement = (index) ->
        child = paneAxisElement.children[index]
        expect(paneAxisElement.isPaneResizeHandleElement(child)).toBe(true)

      models = (new PaneAxis({}) for i in [0..2])
      paneAxis.addChild(models[0])
      paneAxis.addChild(models[1])
      expectResizeElement(1)

      paneAxis.addChild(models[2])
      expectPaneAxisElement(i) for i in [0, 2, 4]
      expectResizeElement(i) for i in [1, 3]

      # test removeChild
      paneAxis.removeChild(models[2])
      expectResizeElement(i) for i in [1, 3]

  describe "when user drag the resize element", ->
    [container, containerElement] = []
    [resizeElementMove, getElementWidth, expectFlexScale] = []

    beforeEach ->
      container = new PaneContainer
