Skip to content

Commit

Permalink
Merge pull request #365 from oat-sa/fix/TR-5398/backport-unwanted-sty…
Browse files Browse the repository at this point in the history
…le-removal-on-choice-interaction-validation

Fix TR-5398 backport unwanted style removal on choice interaction validation
  • Loading branch information
olga-kulish authored Apr 24, 2023
2 parents d3b6735 + b533471 commit 4b2cc4d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oat-sa/tao-item-runner-qti",
"version": "1.3.4",
"version": "1.3.4-1",
"displayName": "TAO Item Runner QTI",
"description": "TAO QTI Item Runner modules",
"files": [
Expand Down
17 changes: 11 additions & 6 deletions src/qtiCommonRenderer/renderers/interactions/ChoiceInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,23 @@ const _setInstructions = function _setInstructions(interaction) {

const highlightInvalidInput = function highlightInvalidInput($choice) {
const $input = $choice.find('.real-label > input');
const $li = $choice.css('color', '#BA122B');
const $icon = $choice.find('.real-label > span').css('color', '#BA122B').addClass('cross error');
const $icon = $choice.find('.real-label > span');

const choiceStyle = $choice.attr('style');
const iconStyle = $icon.attr('style');
$choice.css('color', '#BA122B');
$icon.css('color', '#BA122B').addClass('cross error')

let timeout = interaction.data('__instructionTimeout');

if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(function () {
$input.prop('checked', false);
$li.removeAttr('style');
$icon.removeAttr('style').removeClass('cross');
$li.toggleClass('user-selected', false);
$choice.attr('style', choiceStyle);
$icon.attr('style', iconStyle).removeClass('cross');
$choice.toggleClass('user-selected', false);
containerHelper.triggerResponseChangeEvent(interaction);
}, 150);
interaction.data('__instructionTimeout', timeout);
Expand Down Expand Up @@ -340,7 +345,7 @@ const resetResponse = function resetResponse(interaction) {
* http://www.imsglobal.org/question/qtiv2p1/imsqti_infov2p1.html#element10278
*
* @param {Object} interaction - the interaction instance
* @param {0bject} response - the PCI formated response
* @param {Object} response - the PCI formatted response
*/
const setResponse = function setResponse(interaction, response) {
const $container = containerHelper.get(interaction);
Expand Down

0 comments on commit 4b2cc4d

Please sign in to comment.