mirror of
https://github.com/encounter/react-add-to-calendar.git
synced 2026-07-10 21:18:44 -07:00
initial commit
This commit is contained in:
Executable
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"env": {
|
||||
"mocha": true,
|
||||
},
|
||||
|
||||
"globals": {
|
||||
"assert": true,
|
||||
"describe": true,
|
||||
"expect": true,
|
||||
"sinon": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import TestUtils from 'react-addons-test-utils'
|
||||
import AddToCalendar from '../src/ReactAddToCalendar.js'
|
||||
|
||||
describe('AddToCalendar', () => {
|
||||
it('should show the options menu when the button is clicked', () => {
|
||||
var event = {
|
||||
title: 'Sample Event',
|
||||
description: 'This is the sample event provided as an example only',
|
||||
location: 'Portland, OR',
|
||||
startTime: '2016-09-16T20:15:00-04:00',
|
||||
endTime: '2016-09-16T21:45:00-04:00'
|
||||
}
|
||||
var addToCalendar = TestUtils.renderIntoDocument(
|
||||
<AddToCalendar event={event} />
|
||||
)
|
||||
var button = TestUtils.findRenderedDOMComponentWithTag(addToCalendar, 'a')
|
||||
TestUtils.Simulate.click(ReactDOM.findDOMNode(button))
|
||||
var dropdown = TestUtils.findRenderedDOMComponentWithClass(addToCalendar, 'react-add-to-calendar__dropdown')
|
||||
expect(dropdown).to.exist
|
||||
})
|
||||
|
||||
it('should mount and unmount properly', done => {
|
||||
var TestComponent = React.createClass({
|
||||
displayName: 'TestComponent',
|
||||
|
||||
getInitialState () {
|
||||
return { mounted: true }
|
||||
},
|
||||
render () {
|
||||
return this.state.mounted ? <AddToCalendar /> : null
|
||||
}
|
||||
})
|
||||
var element = TestUtils.renderIntoDocument(<TestComponent />)
|
||||
element.setState({ mounted: false }, done)
|
||||
})
|
||||
})
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
var context = require.context('.', true, /_test$/)
|
||||
context.keys().forEach(context)
|
||||
Reference in New Issue
Block a user