From d06fdd3f8a406a8e4bc54cd8ed9abac50ac8f4c6 Mon Sep 17 00:00:00 2001 From: Sabeur Thabti Date: Mon, 29 Aug 2016 06:34:45 +0100 Subject: [PATCH] missing segment fix (#467) * handle when no segment return state when segments isnt defined ensure to target mp3 audio ensure to target mp3 audio revert audio.mp3 multi-purpose function revert audio.mp3 * multi-purpose function update travis to node 6, use node_modules travis says it cannot find modules(eslint, karma) ditto * fix unit tests fix unit tests --- .travis.yml | 2 +- src/components/Audioplayer/index.js | 2 ++ src/components/TopOptions/spec.js | 6 ++++-- src/helpers/buildAudio.js | 7 +++++++ src/redux/modules/audioplayer.js | 11 +++++------ 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32099e761..5e4886b5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ sudo: false language: node_js env: TEST_SUITE=unit node_js: - - "5.6.0" + - "6.3.0" cache: directories: - node_modules diff --git a/src/components/Audioplayer/index.js b/src/components/Audioplayer/index.js index 2bfc7ed8e..3725a348c 100644 --- a/src/components/Audioplayer/index.js +++ b/src/components/Audioplayer/index.js @@ -344,6 +344,7 @@ export class Audioplayer extends Component { renderPreviousButton() { const { currentAyah, files } = this.props; + if (!files) return false; const index = Object.keys(files).findIndex(id => id === currentAyah); return ( @@ -358,6 +359,7 @@ export class Audioplayer extends Component { renderNextButton() { const { surah, currentAyah } = this.props; + if (!surah) return false; const isEnd = surah.ayat === parseInt(currentAyah.split(':')[1], 10); return ( diff --git a/src/components/TopOptions/spec.js b/src/components/TopOptions/spec.js index 0d4982d8c..a5ba0b004 100644 --- a/src/components/TopOptions/spec.js +++ b/src/components/TopOptions/spec.js @@ -22,8 +22,10 @@ describe("", () => { }; const actions = { - setOption: () => {}, - toggleReadingMode: () => {} + options: { + setOption: () => {}, + toggleReadingMode: () => {} + } }; const component = shallow(