aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-05-05 17:00:43 +0200
committerRobert2017-05-05 17:00:43 +0200
commit9dfc14677c7e3d9c090092658f03bcd9730c1c8e (patch)
tree2a714e106f19aa016fc22fbed864b3b62b57f1c9
parent41b9b5decf022e748c6577baf9756bd785149e6f (diff)
parent757304a4378ba82543e42e21a75b0509272b8d67 (diff)
downloadchouette-core-9dfc14677c7e3d9c090092658f03bcd9730c1c8e.tar.bz2
Merge branch 'master' of github.com:af83/stif-boiv
-rw-r--r--app/assets/stylesheets/modules/_jp_collection.sass16
-rw-r--r--app/assets/stylesheets/modules/_routes_stopoints.sass18
-rw-r--r--app/assets/stylesheets/modules/_vj_collection.sass21
-rw-r--r--spec/javascripts/time_table/reducers/timetable_spec.js166
4 files changed, 219 insertions, 2 deletions
diff --git a/app/assets/stylesheets/modules/_jp_collection.sass b/app/assets/stylesheets/modules/_jp_collection.sass
index d1f864e5c..c109fc71a 100644
--- a/app/assets/stylesheets/modules/_jp_collection.sass
+++ b/app/assets/stylesheets/modules/_jp_collection.sass
@@ -82,3 +82,19 @@
.t2e-head > .td:last-child > div > span
&:after
bottom: 50%
+
+ .t2e-head > .td:nth-child(2) > div,
+ .t2e-head > .td:last-child > div
+ > span:before
+ content: '•'
+ color: $blue
+ text-align: center
+ font-size: 28px
+ letter-spacing: 0
+ text-indent: -0.01em
+ line-height: 12px
+ width: 15px
+ height: 15px
+ left: -23px
+ top: 50%
+ margin-top: -8px
diff --git a/app/assets/stylesheets/modules/_routes_stopoints.sass b/app/assets/stylesheets/modules/_routes_stopoints.sass
index 735e91df7..88e662849 100644
--- a/app/assets/stylesheets/modules/_routes_stopoints.sass
+++ b/app/assets/stylesheets/modules/_routes_stopoints.sass
@@ -12,7 +12,7 @@
height: 100%
> div:first-child
position: relative
- padding-left: 20px /* intial value is 10 */
+ padding-left: 25px /* intial value is 10 */
overflow: hidden
span
@@ -70,3 +70,19 @@
.nested-head + .nested-fields > .wrapper > div:first-child
span:after
top: 5px
+
+ .nested-head + .nested-fields > .wrapper > div:first-child,
+ .nested-fields:last-child > .wrapper:last-child > div:first-child
+ span:before
+ content: '•'
+ color: $blue
+ text-align: center
+ font-size: 28px
+ letter-spacing: 0
+ text-indent: -0.01em
+ line-height: 12px
+ width: 15px
+ height: 15px
+ left: -23px
+ top: 50%
+ margin-top: -8px
diff --git a/app/assets/stylesheets/modules/_vj_collection.sass b/app/assets/stylesheets/modules/_vj_collection.sass
index 46ebda776..8ff983310 100644
--- a/app/assets/stylesheets/modules/_vj_collection.sass
+++ b/app/assets/stylesheets/modules/_vj_collection.sass
@@ -79,6 +79,27 @@
&:after
bottom: -6px
+ .t2e-head > .td:last-child > div > span
+ &:after
+ bottom: 50%
+
+ .table-2entries .t2e-head > .td:nth-child(2) > div,
+ .table-2entries .t2e-head > .td:last-child > div,
+ .table-2entries.no_result .t2e-head > .td:last-child > div
+ > span:before
+ content: '•'
+ color: $blue
+ text-align: center
+ font-size: 28px
+ letter-spacing: 0
+ text-indent: -0.01em
+ line-height: 12px
+ width: 15px
+ height: 15px
+ left: -23px
+ top: 50%
+ margin-top: -8px
+
// Errors
.table-2entries .t2e-item-list
.t2e-item
diff --git a/spec/javascripts/time_table/reducers/timetable_spec.js b/spec/javascripts/time_table/reducers/timetable_spec.js
index 734095cfc..0b418a52e 100644
--- a/spec/javascripts/time_table/reducers/timetable_spec.js
+++ b/spec/javascripts/time_table/reducers/timetable_spec.js
@@ -1,8 +1,26 @@
+require('whatwg-fetch')
var timetableReducer = require('es6_browserified/time_tables/reducers/timetable')
let state = {}
+const dispatch = function(){}
+let arrDayTypes = [true, true, true, true, true, true, true]
+let strDayTypes = 'LuMaMeJeVeSaDi'
+let time_table_periods = [{"id":261,"period_start":"2017-02-23","period_end":"2017-03-05"},{"id":262,"period_start":"2017-03-15","period_end":"2017-03-25"},{"id":263,"period_start":"2017-04-04","period_end":"2017-04-14"},{"id":264,"period_start":"2017-04-24","period_end":"2017-05-04"},{"id":265,"period_start":"2017-05-14","period_end":"2017-05-24"}]
+let current_periode_range = "2017-05-01"
+let periode_range = ["2014-05-01","2014-06-01","2014-07-01","2014-08-01","2014-09-01","2014-10-01","2014-11-01","2014-12-01","2015-01-01","2015-02-01","2015-03-01","2015-04-01","2015-05-01","2015-06-01","2015-07-01","2015-08-01","2015-09-01","2015-10-01","2015-11-01","2015-12-01","2016-01-01","2016-02-01","2016-03-01","2016-04-01","2016-05-01","2016-06-01","2016-07-01","2016-08-01","2016-09-01","2016-10-01","2016-11-01","2016-12-01","2017-01-01","2017-02-01","2017-03-01","2017-04-01","2017-05-01","2017-06-01","2017-07-01","2017-08-01","2017-09-01","2017-10-01","2017-11-01","2017-12-01","2018-01-01","2018-02-01","2018-03-01","2018-04-01","2018-05-01","2018-06-01","2018-07-01","2018-08-01","2018-09-01","2018-10-01","2018-11-01","2018-12-01","2019-01-01","2019-02-01","2019-03-01","2019-04-01","2019-05-01","2019-06-01","2019-07-01","2019-08-01","2019-09-01","2019-10-01","2019-11-01","2019-12-01","2020-01-01","2020-02-01","2020-03-01","2020-04-01","2020-05-01"]
+let current_month = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18","mday":1,"include_date":false,"excluded_date":false},{"day":"mardi","date":"2017-05-02","wday":2,"wnumber":"18","mday":2,"include_date":false,"excluded_date":false},{"day":"mercredi","date":"2017-05-03","wday":3,"wnumber":"18","mday":3,"include_date":false,"excluded_date":false},{"day":"jeudi","date":"2017-05-04","wday":4,"wnumber":"18","mday":4,"include_date":false,"excluded_date":false},{"day":"vendredi","date":"2017-05-05","wday":5,"wnumber":"18","mday":5,"include_date":false,"excluded_date":false},{"day":"samedi","date":"2017-05-06","wday":6,"wnumber":"18","mday":6,"include_date":false,"excluded_date":false},{"day":"dimanche","date":"2017-05-07","wday":0,"wnumber":"18","mday":7,"include_date":false,"excluded_date":false},{"day":"lundi","date":"2017-05-08","wday":1,"wnumber":"19","mday":8,"include_date":false,"excluded_date":false},{"day":"mardi","date":"2017-05-09","wday":2,"wnumber":"19","mday":9,"include_date":false,"excluded_date":false},{"day":"mercredi","date":"2017-05-10","wday":3,"wnumber":"19","mday":10,"include_date":false,"excluded_date":false},{"day":"jeudi","date":"2017-05-11","wday":4,"wnumber":"19","mday":11,"include_date":false,"excluded_date":false},{"day":"vendredi","date":"2017-05-12","wday":5,"wnumber":"19","mday":12,"include_date":false,"excluded_date":false},{"day":"samedi","date":"2017-05-13","wday":6,"wnumber":"19","mday":13,"include_date":false,"excluded_date":false},{"day":"dimanche","date":"2017-05-14","wday":0,"wnumber":"19","mday":14,"include_date":false,"excluded_date":false},{"day":"lundi","date":"2017-05-15","wday":1,"wnumber":"20","mday":15,"include_date":false,"excluded_date":false},{"day":"mardi","date":"2017-05-16","wday":2,"wnumber":"20","mday":16,"include_date":false,"excluded_date":false},{"day":"mercredi","date":"2017-05-17","wday":3,"wnumber":"20","mday":17,"include_date":false,"excluded_date":false},{"day":"jeudi","date":"2017-05-18","wday":4,"wnumber":"20","mday":18,"include_date":false,"excluded_date":false},{"day":"vendredi","date":"2017-05-19","wday":5,"wnumber":"20","mday":19,"include_date":false,"excluded_date":false},{"day":"samedi","date":"2017-05-20","wday":6,"wnumber":"20","mday":20,"include_date":false,"excluded_date":false},{"day":"dimanche","date":"2017-05-21","wday":0,"wnumber":"20","mday":21,"include_date":false,"excluded_date":false},{"day":"lundi","date":"2017-05-22","wday":1,"wnumber":"21","mday":22,"include_date":false,"excluded_date":false},{"day":"mardi","date":"2017-05-23","wday":2,"wnumber":"21","mday":23,"include_date":false,"excluded_date":false},{"day":"mercredi","date":"2017-05-24","wday":3,"wnumber":"21","mday":24,"include_date":false,"excluded_date":false},{"day":"jeudi","date":"2017-05-25","wday":4,"wnumber":"21","mday":25,"include_date":false,"excluded_date":false},{"day":"vendredi","date":"2017-05-26","wday":5,"wnumber":"21","mday":26,"include_date":false,"excluded_date":false},{"day":"samedi","date":"2017-05-27","wday":6,"wnumber":"21","mday":27,"include_date":false,"excluded_date":false},{"day":"dimanche","date":"2017-05-28","wday":0,"wnumber":"21","mday":28,"include_date":false,"excluded_date":false},{"day":"lundi","date":"2017-05-29","wday":1,"wnumber":"22","mday":29,"include_date":false,"excluded_date":false},{"day":"mardi","date":"2017-05-30","wday":2,"wnumber":"22","mday":30,"include_date":false,"excluded_date":false},{"day":"mercredi","date":"2017-05-31","wday":3,"wnumber":"22","mday":31,"include_date":false,"excluded_date":false}]
-describe('timetable reducer', () => {
+let newCurrentMonth = [{"day":"lundi","date":"2017-05-01","wday":1,"wnumber":"18","mday":1,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-02","wday":2,"wnumber":"18","mday":2,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-03","wday":3,"wnumber":"18","mday":3,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-04","wday":4,"wnumber":"18","mday":4,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-05","wday":5,"wnumber":"18","mday":5,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-06","wday":6,"wnumber":"18","mday":6,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-07","wday":0,"wnumber":"18","mday":7,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-08","wday":1,"wnumber":"19","mday":8,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-09","wday":2,"wnumber":"19","mday":9,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-10","wday":3,"wnumber":"19","mday":10,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"jeudi","date":"2017-05-11","wday":4,"wnumber":"19","mday":11,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-12","wday":5,"wnumber":"19","mday":12,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-13","wday":6,"wnumber":"19","mday":13,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-14","wday":0,"wnumber":"19","mday":14,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-15","wday":1,"wnumber":"20","mday":15,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-16","wday":2,"wnumber":"20","mday":16,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-17","wday":3,"wnumber":"20","mday":17,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-18","wday":4,"wnumber":"20","mday":18,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"vendredi","date":"2017-05-19","wday":5,"wnumber":"20","mday":19,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"samedi","date":"2017-05-20","wday":6,"wnumber":"20","mday":20,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"dimanche","date":"2017-05-21","wday":0,"wnumber":"20","mday":21,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"lundi","date":"2017-05-22","wday":1,"wnumber":"21","mday":22,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mardi","date":"2017-05-23","wday":2,"wnumber":"21","mday":23,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"mercredi","date":"2017-05-24","wday":3,"wnumber":"21","mday":24,"include_date":false,"excluded_date":false,"in_periods":true},{"day":"jeudi","date":"2017-05-25","wday":4,"wnumber":"21","mday":25,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"vendredi","date":"2017-05-26","wday":5,"wnumber":"21","mday":26,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"samedi","date":"2017-05-27","wday":6,"wnumber":"21","mday":27,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"dimanche","date":"2017-05-28","wday":0,"wnumber":"21","mday":28,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"lundi","date":"2017-05-29","wday":1,"wnumber":"22","mday":29,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mardi","date":"2017-05-30","wday":2,"wnumber":"22","mday":30,"include_date":false,"excluded_date":false,"in_periods":false},{"day":"mercredi","date":"2017-05-31","wday":3,"wnumber":"22","mday":31,"include_date":false,"excluded_date":false,"in_periods":false}]
+
+let json = {
+ current_month: current_month,
+ current_periode_range: current_periode_range,
+ periode_range: periode_range,
+ time_table_periods: time_table_periods,
+ day_types: strDayTypes
+}
+
+describe('timetable reducer with empty state', () => {
beforeEach(() => {
state = {
current_month: [],
@@ -17,4 +35,150 @@ describe('timetable reducer', () => {
timetableReducer(undefined, {})
).toEqual({})
})
+
+ it('should handle RECEIVE_TIME_TABLES', () => {
+ let newState = {
+ current_month: newCurrentMonth,
+ current_periode_range: current_periode_range,
+ periode_range: periode_range,
+ time_table_periods: time_table_periods,
+ }
+ expect(
+ timetableReducer(state, {
+ type: 'RECEIVE_TIME_TABLES',
+ json
+ })
+ ).toEqual(newState)
+ })
+})
+
+describe('timetable reducer with filled state', () => {
+ beforeEach(() => {
+ state = {
+ current_month: newCurrentMonth,
+ current_periode_range: current_periode_range,
+ periode_range: periode_range,
+ time_table_periods: time_table_periods,
+ }
+ })
+
+ it('should handle RECEIVE_MONTH', () => {
+ expect(
+ timetableReducer(state, {
+ type: 'RECEIVE_MONTH',
+ json: {
+ days: current_month,
+ day_types: strDayTypes
+ }
+ })
+ ).toEqual(state)
+ })
+
+
+ it('should handle GO_TO_PREVIOUS_PAGE', () => {
+ let pagination = {
+ periode_range: periode_range,
+ currentPage: current_periode_range
+ }
+ expect(
+ timetableReducer(state, {
+ type: 'GO_TO_PREVIOUS_PAGE',
+ dispatch,
+ pagination,
+ nextPage: false
+ })
+ ).toEqual(Object.assign({}, state, {current_periode_range: '2017-04-01'}))
+ })
+
+ it('should handle GO_TO_NEXT_PAGE', () => {
+ let pagination = {
+ periode_range: periode_range,
+ currentPage: current_periode_range
+ }
+ expect(
+ timetableReducer(state, {
+ type: 'GO_TO_NEXT_PAGE',
+ dispatch,
+ pagination,
+ nextPage: true
+ })
+ ).toEqual(Object.assign({}, state, {current_periode_range: '2017-06-01'}))
+ })
+
+ it('should handle CHANGE_PAGE', () => {
+ const actions = {
+ fetchTimeTables: function(){}
+ }
+ let newPage = '2017-05-01'
+ expect(
+ timetableReducer(state, {
+ type: 'CHANGE_PAGE',
+ dispatch,
+ page: newPage
+ })
+ ).toEqual(Object.assign({}, state, {current_periode_range: newPage}))
+ })
+
+ it('should handle DELETE_PERIOD', () => {
+ state.time_table_periods[0].deleted = true
+ expect(
+ timetableReducer(state, {
+ type: 'DELETE_PERIOD',
+ index: 0,
+ dayTypes: arrDayTypes
+ })
+ ).toEqual(state)
+ })
+
+ it('should handle INCLUDE_DATE_IN_PERIOD', () => {
+ state.current_month[4].include_date = true
+ expect(
+ timetableReducer(state, {
+ type: 'INCLUDE_DATE_IN_PERIOD',
+ index: 4,
+ dayTypes: arrDayTypes
+ })
+ ).toEqual(state)
+ })
+
+ it('should handle EXCLUDE_DATE_FROM_PERIOD', () => {
+ state.current_month[0].excluded_date = true
+ expect(
+ timetableReducer(state, {
+ type: 'EXCLUDE_DATE_FROM_PERIOD',
+ index: 0,
+ dayTypes: arrDayTypes
+ })
+ ).toEqual(state)
+ })
+
+ it('should handle VALIDATE_PERIOD_FORM', () => {
+ state.current_month[13].in_periods = false
+ state.time_table_periods[4].period_start = '2017-05-15'
+ let modalProps = {
+ active: false,
+ begin: {
+ day: '15',
+ month: '05',
+ year: '2017'
+ },
+ end: {
+ day: '24',
+ month: '05',
+ year: '2017'
+ },
+ error: '',
+ index: 4
+ }
+ expect(
+ timetableReducer(state, {
+ type: 'VALIDATE_PERIOD_FORM',
+ modalProps: modalProps,
+ timeTablePeriods: state.time_table_periods,
+ metas: {
+ day_types: arrDayTypes
+ }
+ })
+ ).toEqual(state)
+ })
})