import React from 'react'
import {mount, shallow} from 'enzyme'
import {expect} from 'chai'

import Pagination from '../src/components/Pagination'

describe('<Pagination/>', function () {
  const wrapper = mount(<Pagination/>)

  it('has no "previous" button if currentPage is 1', function () {
    wrapper.setProps({ currentPage: 1, totalPages: 10 })
    expect(wrapper.find('.previous')).to.have.length(0)
  })

  it('shows the "previous" button if currentPage gt 1', function () {
    wrapper.setProps({ currentPage: 2, totalPages: 10 })
    expect(wrapper.find('.previous')).to.have.length(1)
  })

  it('shows the "next" button if totalPages is not reached', function () {
    wrapper.setProps({ currentPage: 2, totalPages: 10 })
    expect(wrapper.find('.next')).to.have.length(1)
  })

  it('has no "next" button if totalPages is reached', function () {
    wrapper.setProps({ currentPage: 10, totalPages: 10 })
    expect(wrapper.find('.next')).to.have.length(0)
  })

  it('shows neither "next" nor "previous" buttons if totalPages lt 2', function () {
    wrapper.setProps({ currentPage: 1, totalPages: 1 })
    expect(wrapper.find('.next')).to.have.length(0)
    expect(wrapper.find('.previous')).to.have.length(0)
  })
})

@@ -231,18 +231,26 @@
 it('has 
-no
+a disabled
  %22previo
@@ -379,32 +379,41 @@
 .find('.previous
+.disabled
 ')).to.have.leng
@@ -407,33 +407,33 @@
 .to.have.length(
-0
+1
 )%0A  %7D)%0A%0A  it('sh
@@ -430,25 +430,30 @@
 %0A%0A  it('
-shows the
+has an enabled
  %22previo
@@ -618,27 +618,97 @@
 )%0A  
-%7D)%0A%0A  it('shows the
+  expect(wrapper.find('.previous.disabled')).to.have.length(0)%0A  %7D)%0A%0A  it('has an enabled
  %22ne
@@ -864,32 +864,93 @@
 .have.length(1)%0A
+    expect(wrapper.find('.next.disabled')).to.have.length(0)%0A
   %7D)%0A%0A  it('has 
@@ -949,18 +949,26 @@
 it('has 
-no
+a disabled
  %22next%22 
@@ -1095,32 +1095,41 @@
 pper.find('.next
+.disabled
 ')).to.have.leng
@@ -1123,33 +1123,33 @@
 .to.have.length(
-0
+1
 )%0A  %7D)%0A%0A  it('sh
@@ -1150,29 +1150,28 @@
 it('
-shows neither
+has disabled
  %22next%22 
 nor 
@@ -1170,11 +1170,11 @@
 xt%22 
-nor
+and
  %22pr
@@ -1302,32 +1302,41 @@
 pper.find('.next
+.disabled
 ')).to.have.leng
@@ -1334,25 +1334,25 @@
 have.length(
-0
+1
 )%0A    expect
@@ -1367,32 +1367,41 @@
 .find('.previous
+.disabled
 ')).to.have.leng
@@ -1399,23 +1399,23 @@
 have.length(
-0
+1
 )%0A  %7D)%0A%7D)%0A

Fix spec