More tests and fixes

This commit is contained in:
Jonathan Putney
2019-11-14 16:07:42 -05:00
parent caa5977a4b
commit 929176fb3e
14 changed files with 385 additions and 238 deletions

View File

@@ -10,6 +10,7 @@ import {scorm12_constants} from '../constants/api_constants';
import {scorm12_error_codes} from '../constants/error_codes';
import {scorm12_regex} from '../constants/regex';
import {ValidationError} from '../exceptions';
import * as Utilities from '../utilities';
const constants = scorm12_constants;
const regex = scorm12_regex;
@@ -244,6 +245,15 @@ export class CMI extends BaseCMI {
this.#comments_from_lms = comments_from_lms :
throwReadOnlyError();
}
/**
* Adds the current session time to the existing total time.
*
* @return {string}
*/
getCurrentTotalTime() {
return this.core.getCurrentTotalTime();
}
}
/**
@@ -475,6 +485,19 @@ class CMICore extends BaseCMI {
}
}
/**
* Adds the current session time to the existing total time.
*
* @return {string}
*/
getCurrentTotalTime() {
return Utilities.addHHMMSSTimeStrings(
this.#total_time,
this.#session_time,
new RegExp(scorm12_regex.CMITimespan)
);
}
/**
* toJSON for cmi.core
*