Only allowing 'not attempted' when CMI has not been initialized
This commit is contained in:
8
dist/scorm-again.js
vendored
8
dist/scorm-again.js
vendored
File diff suppressed because one or more lines are too long
2
dist/scorm-again.js.map
vendored
2
dist/scorm-again.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/scorm-again.min.js
vendored
2
dist/scorm-again.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "scorm-again",
|
"name": "scorm-again",
|
||||||
"version": "1.5.2",
|
"version": "1.5.3",
|
||||||
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
||||||
"main": "dist/scorm-again.min.js",
|
"main": "dist/scorm-again.min.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -400,10 +400,16 @@ class CMICore extends BaseCMI {
|
|||||||
* @param {string} lesson_status
|
* @param {string} lesson_status
|
||||||
*/
|
*/
|
||||||
set lesson_status(lesson_status) {
|
set lesson_status(lesson_status) {
|
||||||
|
if (this.initialized) {
|
||||||
|
if (check12ValidFormat(lesson_status, scorm12_regex.CMIStatus)) {
|
||||||
|
this.#lesson_status = lesson_status;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (check12ValidFormat(lesson_status, scorm12_regex.CMIStatus2)) {
|
if (check12ValidFormat(lesson_status, scorm12_regex.CMIStatus2)) {
|
||||||
this.#lesson_status = lesson_status;
|
this.#lesson_status = lesson_status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for #entry
|
* Getter for #entry
|
||||||
|
|||||||
@@ -438,15 +438,25 @@ describe('SCORM 1.2 CMI Tests', () => {
|
|||||||
expectedValue: 'not attempted',
|
expectedValue: 'not attempted',
|
||||||
});
|
});
|
||||||
h.checkWrite({
|
h.checkWrite({
|
||||||
cmi: cmiInitialized(),
|
cmi: cmi(),
|
||||||
fieldName: 'cmi.core.lesson_status',
|
fieldName: 'cmi.core.lesson_status',
|
||||||
valueToTest: 'not attempted',
|
valueToTest: 'not attempted',
|
||||||
});
|
});
|
||||||
|
h.checkValidValues({
|
||||||
|
cmi: cmi(),
|
||||||
|
fieldName: 'cmi.core.lesson_status',
|
||||||
|
validValues: scorm12_values.validLessonStatus.concat([
|
||||||
|
'not attempted',
|
||||||
|
]),
|
||||||
|
invalidValues: scorm12_values.invalidLessonStatus,
|
||||||
|
});
|
||||||
h.checkValidValues({
|
h.checkValidValues({
|
||||||
cmi: cmiInitialized(),
|
cmi: cmiInitialized(),
|
||||||
fieldName: 'cmi.core.lesson_status',
|
fieldName: 'cmi.core.lesson_status',
|
||||||
validValues: scorm12_values.validLessonStatus,
|
validValues: scorm12_values.validLessonStatus,
|
||||||
invalidValues: scorm12_values.invalidLessonStatus,
|
invalidValues: scorm12_values.invalidLessonStatus.concat([
|
||||||
|
'not attempted',
|
||||||
|
]),
|
||||||
});
|
});
|
||||||
h.checkReadOnly({
|
h.checkReadOnly({
|
||||||
cmi: cmiInitialized(),
|
cmi: cmiInitialized(),
|
||||||
|
|||||||
Reference in New Issue
Block a user