aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/actions_spec.js2
-rw-r--r--spec/javascripts/components_spec.js40
-rw-r--r--spec/javascripts/reducers_spec.js9
-rw-r--r--spec/javascripts/spec_helper.js1
4 files changed, 46 insertions, 6 deletions
diff --git a/spec/javascripts/actions_spec.js b/spec/javascripts/actions_spec.js
index 55de1c31f..f86466375 100644
--- a/spec/javascripts/actions_spec.js
+++ b/spec/javascripts/actions_spec.js
@@ -1,4 +1,4 @@
-var actions = require('es6_browserified/actions')
+var actions = require('es6_browserified/itineraries/actions')
describe('actions', () => {
it('should create an action to add a stop', () => {
diff --git a/spec/javascripts/components_spec.js b/spec/javascripts/components_spec.js
new file mode 100644
index 000000000..c7e541783
--- /dev/null
+++ b/spec/javascripts/components_spec.js
@@ -0,0 +1,40 @@
+var React = require('react');
+var Provider = require('react-redux').Provider;
+var actions = require('es6_browserified/itineraries/actions/index');
+var App = require('es6_browserified/itineraries/components/TodoList');
+var ConnectedApp = require('es6_browserified/itineraries/containers/VisibleTodoList');
+var TestUtils = require('react-addons-test-utils');
+
+xdescribe('ConnectedApp', function() {
+ var connectedApp, store, initialItems;
+ var state;
+ state = [
+ {
+ text: 'first',
+ index: 0,
+ for_boarding: 'normal',
+ for_alighting: 'normal'
+ },
+ {
+ text: 'second',
+ index: 1,
+ for_boarding: 'normal',
+ for_alighting: 'normal'
+ }
+ ]
+
+ beforeEach(function() {
+ store = state
+ });
+
+ describe('state provided by the store', function() {
+ beforeEach(function() {
+ connectedApp = TestUtils.renderIntoDocument(<Provider store={store}><ConnectedApp/></Provider>);
+ });
+
+ it('passes down items', function() {
+ app = TestUtils.findRenderedComponentWithType(connectedApp, App);
+ expect(app.props.items).toEqual(initialItems);
+ });
+ });
+});
diff --git a/spec/javascripts/reducers_spec.js b/spec/javascripts/reducers_spec.js
index a4880e73e..253229dda 100644
--- a/spec/javascripts/reducers_spec.js
+++ b/spec/javascripts/reducers_spec.js
@@ -1,4 +1,4 @@
-var reducer = require('es6_browserified/reducers/todos')
+var reducer = require('es6_browserified/itineraries/reducers/todos')
let state = []
describe('stops reducer', () => {
beforeEach(()=>{
@@ -120,7 +120,7 @@ describe('stops reducer', () => {
})
//TODO unskip when es6 is properly functionnal
- xit('should handle UPDATE_INPUT_VALUE', () => {
+ it('should handle UPDATE_INPUT_VALUE', () => {
expect(
reducer(state, {
type: 'UPDATE_INPUT_VALUE',
@@ -149,7 +149,7 @@ describe('stops reducer', () => {
)
})
- xit('should handle UPDATE_SELECT_VALUE', () => {
+ it('should handle UPDATE_SELECT_VALUE', () => {
expect(
reducer(state, {
type :'UPDATE_SELECT_VALUE',
@@ -160,9 +160,8 @@ describe('stops reducer', () => {
).toEqual(
[
{
- text: 'new value',
+ text: 'first',
index: 0,
- stoparea_id: 1,
for_boarding: 'prohibited',
for_alighting: 'normal'
},
diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js
index 71d30ff8d..a2fde3860 100644
--- a/spec/javascripts/spec_helper.js
+++ b/spec/javascripts/spec_helper.js
@@ -4,6 +4,7 @@
// require support/jasmine-jquery-2.1.0
// require support/sinon
// require support/your-support-file
+require('es6-object-assign').polyfill();
//
// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
// Use this polyfill to avoid the confusion.