Commit c615976b authored by Alexey Beloglazov's avatar Alexey Beloglazov Committed by Ev Maslovskiy
Browse files

Issue #3313461: Cover quizzes with tests

parent 09911b9a
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ npm:
    - cd js
    - npm install
    - npm run build
  variables:
    NODE_OPTIONS: --openssl-legacy-provider
  # Use artifacts to copy dependencies and built files to subsequent jobs.
  artifacts:
    expire_in: 1 week
@@ -53,4 +55,4 @@ dist-folder-outdated:
# Install required packages to run testing.
phpunit:
  before_script:
    - composer require --prefer-stable drupal/range drupal/views_data_export drupal/xls_serialization
    - composer require --prefer-stable drupal/range:^1 drupal/views_data_export:^1 drupal/xls_serialization:^1
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added "data-test" attributes for "checklist items" and "loading indicator".
- Display "loading indicator" only if a user have permissions to tick/un-tick checklist items.
- #3312217: Cover creation of lessons with tests.
- #3313461: Cover quizzes with tests.

## [2.9.0]
- #3312107: Highlighting should be applied for whole words.
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+48 −6
Original line number Diff line number Diff line
@@ -23,29 +23,71 @@ const SuccessCheckbox = withStyles((theme) => ({
  },
}))(Checkbox);

const CheckboxWithValidation = ({ value, correctValues, checked, ...props }) => {
const CheckboxWithValidation = ({ optionId, value, correctValues, checked, ...props }) => {
  if (correctValues) {
    if (checked && correctValues.includes(value)) {
      return <SuccessCheckbox value={value} checked {...props} />;
      return (
        <SuccessCheckbox
          value={value}
          checked
          {...props}
          data-checkbox-option={optionId}
          data-test={'anu-lms-checkbox-success'}
        />
      );
    }

    if (!checked && correctValues.includes(value)) {
      return <ErrorCheckbox value={value} checked {...props} />;
      return (
        <ErrorCheckbox
          value={value}
          checked
          {...props}
          data-checkbox-option={optionId}
          data-test={'anu-lms-checkbox-correct-error'}
        />
      );
    }

    if (checked && !correctValues.includes(value)) {
      return <ErrorCheckbox value={value} checked checkedIcon={<Clear />} {...props} />;
      return (
        <ErrorCheckbox
          value={value}
          checked
          checkedIcon={<Clear />}
          {...props}
          data-checkbox-option={optionId}
          data-test={'anu-lms-checkbox-incorrect-error'}
        />
      );
    }

    if (!checked && !correctValues.includes(value)) {
      return <Checkbox value={value} checked={checked} {...props} />;
      return (
        <Checkbox
          value={value}
          checked={checked}
          {...props}
          data-checkbox-option={optionId}
          data-test={'anu-lms-checkbox'}
        />
      );
    }
  }

  return <Checkbox value={value} checked={checked} {...props} />;
  return (
    <Checkbox
      value={value}
      checked={checked}
      {...props}
      data-checkbox-option={optionId}
      data-test={'anu-lms-checkbox'}
    />
  );
};

CheckboxWithValidation.propTypes = {
  optionId: PropTypes.string,
  value: PropTypes.string,
  correctValues: PropTypes.array,
  checked: PropTypes.bool,
Loading