/**
 * Test case for apPureMixin.
 * Runs with mocha.
 */
'use strict'

import ApDeepPureMixin from '../lib/ap_deep_pure_mixin'
import React from 'react'
import ReactDOM from 'react-dom/server'

const assert = require('assert')

describe('ap-deep-pure-mixin', function () {
  this.timeout(3000)

  before(() => {

  })

  after(() => {

  })

  it('Demo mixin', () => {
    const MockClass = React.createClass({
      mixins: [
        ApDeepPureMixin
      ],
      render () {
        const s = this
        return React.createElement('div', {})
      },
      componentWillMount () {
        const s = this
        assert.ok(s.$apDeepPureMixin, true)
        assert.equal(s.shouldComponentUpdate(s.props, s.state), false)
        assert.equal(s.shouldComponentUpdate(s.props, { foo: 'bar' }), true)
      }
    })
    let elm = React.createElement(MockClass, {})
    let html = ReactDOM.renderToString(elm)
    assert.ok(html)
  })
})

/* global describe, before, after, it */
