Sha256: 6a635199c6094b13a5983d69f659185943f59e27815972b38139554583f45734

Contents?: true

Size: 1.59 KB

Versions: 16

Compression:

Stored size: 1.59 KB

Contents

describe 'Integration: Tags', ->
  before ->
    authenticateSession()
    stubAjax 'GET', '/api/tags', 200, FIXTURES.tags()

  after ->
    $.mockjaxClear()
    Dashboard.reset()

  it 'has Tags link on sidebar', ->
    expect(1)
    visit '/'
    andThen ->
      equal(find(".sidebar-menu a:contains('Tags')").length, 1)

  it 'has page title in the content header', ->
    expect(1)

    visit '/tags'
    andThen ->
      equal find('.content-header h1').text(), 'Tags'

  it 'list the tags', ->
    expect(1)

    visit '/tags'
    andThen ->
      equal find('table tbody tr').length, 2

  describe 'pagination', ->
    before ->
      sinon.spy(jQuery, 'ajax')

    after ->
      jQuery.ajax.restore()

    context 'When clicked on the page number', ->
      it 'fetch new data filtering by page', ->
        expect(2)

        visit '/tags'
        andThen ->
          equal find('ul.pagination li').length, 11

        andThen ->
          click('ul.pagination li:eq(3) a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/tags', data: { page: 3 } }))

    context 'When clicked on previous page', ->
      it 'fetch new data filtering by page', ->
        expect(1)

        visit '/tags'
        andThen ->
          click('ul.pagination li:first a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/tags', data: { page: 2 } }))

    context 'When clicked on next page', ->
      it 'fetch new data filtering by page', ->
        expect(1)

        visit '/tags'
        andThen ->
          click('ul.pagination li:last a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/tags', data: { page: 4 } }))

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dune-dashboard-1.1.5 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.1.4 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.1.3 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.1.2 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.1.1 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.1.0 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.9 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.8 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.7 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.6 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.5 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.4 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.3 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.2 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.1 spec/javascripts/integration/tags_spec.coffee
dune-dashboard-1.0.0 spec/javascripts/integration/tags_spec.coffee