     expect(axis.panel).to.be.an.instanceOf(SidePanel)
 
   it "should have a SidePanel after plot.add_layout is called", ->
-    pp = new Plot({
-      x_range: new Range1d({start: 0, end: 1})
-      y_range: new Range1d({start: 0, end: 1})
-    })
-    p = pp.plot_canvas
-    p.attach_document(new Document())
     ticker = new BasicTicker()
     formatter = new BasicTickFormatter()
     axis = new Axis({
       ticker: ticker
       formatter: formatter
-      plot: p
     })
-    axis.attach_document(p.document)
     expect(axis.panel).to.be.undefined
+    p = new Plot({
+      x_range: new Range1d({start: 0, end: 1})
+      y_range: new Range1d({start: 0, end: 1})
+    })
     p.add_layout(axis, 'left')
+    p.attach_document(new Document())
     expect(axis.panel).to.be.an.instanceOf(SidePanel)
 
 describe "Axis.View", ->

      ticker: ticker
      formatter: formatter
    })
    test_plot_canvas.add_layout(@axis, 'below')
    # Must create the test_plot_view after adding the axis to the plot
    test_plot_canvas_view = new test_plot_canvas.default_view({ 'model': test_plot_canvas })
    @axis_view = new @axis.default_view({
      model: @axis
      plot_model: test_plot_canvas
      plot_view: test_plot_canvas_view
    })

  it "_tick_extent should return the major_tick_out property", ->

describe "Axis.Model", ->

  it "should have a SidePanel after add_panel is called", ->
    p = new Plot({
      x_range: new Range1d({start: 0, end: 1})
      y_range: new Range1d({start: 0, end: 1})
    })
    p.attach_document(new Document())
    ticker = new BasicTicker()
    formatter = new BasicTickFormatter()
