Skip to content

Commit 06c23ab

Browse files
committed
removing ceil from progress generation
1 parent 8b3bc23 commit 06c23ab

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

app/components/Progress.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ function workOutProgressValue(duration, currentTime) {
77
const remainingTime = (duration - difference);
88
const progressPercentage = (remainingTime / duration) * 100;
99

10-
return Math.ceil(progressPercentage);
10+
return progressPercentage;
1111
}
1212

1313
class Progress extends Component {
14-
1514
render() {
1615
const progress = workOutProgressValue(this.props.duration, this.props.currentTime);
1716

app/store/mapStoreToPlayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function setupPlayer(player) {
2525
function setupDispatch(store, player) {
2626
player.addEventListener('ended', () => store.dispatch(hasStopped(true)));
2727
player.addEventListener('loadedmetadata', () => {
28-
const duration = Math.ceil(parseFloat(player.duration));
28+
const duration = parseFloat(player.duration);
2929
store.dispatch(setDuration(duration));
3030
});
3131
player.addEventListener('timeupdate', () => {

test/components/Progress.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ describe('<Progress />', () => {
1515
assert.equal(wrapper.find('progress').prop('max'), 100);
1616
});
1717

18-
it('adds 35 as the value on the progress tag', () => {
19-
const currentTime = 666;
18+
it('adds 50 as the value on the progress tag', () => {
19+
const currentTime = 1000;
2020
const duration = 2000;
2121
const wrapper = shallow(
2222
<Progress currentTime={currentTime} duration={duration} />
2323
);
2424

25-
assert.equal(wrapper.find('progress').prop('value'), 34);
25+
assert.equal(wrapper.find('progress').prop('value'), 50);
2626
});
2727
});

test/store/mapStoreToPlayer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ describe('mapStoreToPlayer', () => {
156156
unsubscribe();
157157
});
158158

159-
it('dispatched SET_DURATION: {NUMBER} when the player is loaded', () => {
159+
it('dispatched SET_DURATION: {NUMBER} when the player metadata is loaded', () => {
160160
const player = setupPlayer({
161161
duration: 74.5
162162
});
163163
const unsubscribe = mapStoreToPlayer(store, player);
164164
const expectedCallArgs = {
165165
type: SET_DURATION,
166-
duration: 75
166+
duration: 74.5
167167
};
168168

169169
player.loadedmetadata();

0 commit comments

Comments
 (0)