InfoPanel = require '../../coffee/views/info-panel'

describe 'Info panel view', ->
  infoPanel = new InfoPanel()

  it 'should be a div element', ->
    infoPanel.tagName.should.equal('div')

  it 'should have the right class', ->
    infoPanel.className.should.equal('info-panel')

  it 'should be a Backbone View', ->
    infoPanel.should.be.an.instanceof(Backbone.View)

  describe 'render', ->
    it 'should return a reference to the object', ->
      infoPanel.render().should.equal(infoPanel)

  describe 'template function', ->
    html = JST.info_panel({
      name: 'foo'
      modified: new Date()
      created: new Date()
      versions: 10
    })

    it 'should return a string', ->
      html.should.be.a('string')
      html.should.have.length.above(0)

    it 'should interpolate the name', ->
      html.should.contain('foo')
