Skip to content

Commit

Permalink
Fixed UUT given change with time code method
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa8626 committed Oct 28, 2017
1 parent 834e9bd commit 41c55ed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/mediaelement-and-player.js
Expand Up @@ -8281,7 +8281,7 @@ function secondsToTimeCode(time) {
var showFrameCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 25;
var secondsDecimalLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
var timeFormat = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'mm:ss';
var timeFormat = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'hh:mm:ss';


time = !time || typeof time !== 'number' || time < 0 ? 0 : time;
Expand Down
2 changes: 1 addition & 1 deletion build/mediaelement-and-player.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/js/utils/time.js
Expand Up @@ -22,7 +22,7 @@ export function isDropFrame(fps = 25) {
* @param {String} timeFormat
* @return {String}
*/
export function secondsToTimeCode(time, forceHours = false, showFrameCount = false, fps = 25, secondsDecimalLength = 0, timeFormat = 'mm:ss') {
export function secondsToTimeCode(time, forceHours = false, showFrameCount = false, fps = 25, secondsDecimalLength = 0, timeFormat = 'hh:mm:ss') {

time = !time || typeof time !== 'number' || time < 0 ? 0 : time;

Expand Down
15 changes: 9 additions & 6 deletions test/unit/utils.spec.js
Expand Up @@ -210,12 +210,12 @@ describe('Utilities', () => {

expect(time.secondsToTimeCode(36.45, false, true, 32)).to.equal('00:36:14');
expect(time.secondsToTimeCode(70.89, true, true, 40)).to.equal('00:01:10:36');
expect(time.secondsToTimeCode(3600.234, true, true)).to.equal('01:00:00:06');
expect(time.secondsToTimeCode(3600.234, true, true, 25, 0, 'hh:mm:ss:ff')).to.equal('01:00:00:06');
});

it('checks if frames per second has decimals and adjust the time code', () => {
expect(time.secondsToTimeCode(36.45, false, true, 32.46)).to.equal('00:36;31');
expect(time.secondsToTimeCode(70.87465, false, true, 32.6891, 3)).to.equal('01:10;09');
expect(time.secondsToTimeCode(70.87465, false, true, 32.6891, 3, 'mm:ss:ff')).to.equal('01:10;09');
expect(time.secondsToTimeCode(0.378, false, true, 300.2, 3)).to.equal('00:00;113');
});

Expand Down Expand Up @@ -271,18 +271,21 @@ describe('Utilities', () => {

const options = {
timeFormat: 'mm:ss',
currentTimeFormat: '',
};

it('attempts to fix time format (i.e., `hh:mm:ss:ff`)', () => {
time.calculateTimeFormat(36, options);
expect(options.currentTimeFormat).to.equal('mm:ss');
expect(options.timeFormat).to.equal('mm:ss');

options.timeFormat = 'mm:ss';

time.calculateTimeFormat(3600, options);
expect(options.currentTimeFormat).to.equal('hh:mm:ss');
expect(options.timeFormat).to.equal('hh:mm:ss');

options.timeFormat = 'mm:ss';

time.calculateTimeFormat(36.432, options, 32);
expect(options.currentTimeFormat).to.equal('mm:ss');
expect(options.timeFormat).to.equal('mm:ss');
});

it('can only accept numeric values for the time', () => {
Expand Down

0 comments on commit 41c55ed

Please sign in to comment.