Skip to content
Snippets Groups Projects

Configure testing with GitLab CI

Closes #3423942

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 (function ($, Drupal) {
2
3 /**
4 * Enhancements to states.js.
5 */
6 // Checking if autocomplete is plugged in.
7 if (Drupal.autocomplete) {
1 /* eslint-disable no-unused-vars */
2 /* eslint-disable no-restricted-syntax */
3 /* eslint-disable eqeqeq */
  • 97 }
    98 // Go invisible.
    99 if (!e.value) {
    100 // Remove required property.
    101 $field.trigger({
    102 type: 'state:required',
    103 value: false,
    104 trigger: true,
    105 });
    106 }
    107
    108 // Go visible.
    109 else {
    110 // Restore required if necessary.
    111 // eslint-disable-next-line no-lonely-if
    112 if ($field.data('conditionalFieldsSavedRequired')) {
  • 273 ) {
    274 return false;
    275 }
    276 }
    277 return true;
    278 };
    237 279
    238 280 /**
    239 * Adds RegEx support
    240 * https://www.drupal.org/node/1340616
    281 * Handle object values for Drupal.states.Dependent.comparisons.Object.
    282 *
    283 * @param {Object} reference - The reference object for comparison.
    284 * @param {string|Array} value - The value to compare with the reference.
    285 * @return {boolean} True if the comparison succeeds; otherwise, false.
    241 286 */
    • Comment on lines 238 to 241

      Can we be more explicit than "if the comparison succeeds"? There seem to be 3 cases: reference contains regex, it contains xor, or (default) it contains neither.

    • Please register or sign in to reply
  • 295 if (value && value.constructor.name == 'Array') {
    296 for (const index in value) {
    297 if (regObj.test(value[index])) {
    298 return true;
    299 }
    300 }
    301 return false;
    249 302 }
    250 }
    251 return false;
    252 } else {
    253 303 return regObj.test(value);
    304
    305 // Adds single XOR support
    254 306 }
    255 //Adds single XOR support
  • 266 eq_count++;
    307 if ('xor' in reference) {
    308 let compare = [];
    309 if (typeof value === 'string') {
    310 compare = value.split(/\r?\n\r?/);
    311 } else if (typeof value === 'object' && value instanceof Array) {
    312 compare = value;
    267 313 }
    314 let eqCount = 0;
    315 for (const key in reference.xor) {
    316 if (
    317 reference.xor.hasOwnProperty(key) &&
    318 $.inArray(reference.xor[key], compare) >= 0
    319 ) {
    320 // eslint-disable-next-line no-plusplus
    321 eqCount++;
  • 288 }
    289 }
    290 };
    343 },
    344 };
    291 345
    292 346 /**
    293 * The function for compare two strings
    294 * @param a
    295 * @param b
    296 * @returns {boolean|*}
    347 * Compare two strings after removing leading and trailing newline characters.
    348 *
    349 * @param {string|undefined} a - The first string to compare.
    350 * @param {string|undefined} b - The second string to compare.
    351 * @return {boolean|undefined} True if the strings are equal, undefined if either string is undefined.
  • Benji Fisher
  • Benji Fisher
  • Benji Fisher added 1 commit

    added 1 commit

    • e4fdeee8 - Update tests to use lowerCamelCase properties of the non-test classes

    Compare with previous version

  • Benji Fisher added 2 commits

    added 2 commits

    • 57729a08 - Let DrupalCI decide where the Drupal root is (PHPStan)
    • cb322a9a - Tell phpcs to ignore a line that is commented out

    Compare with previous version

  • Benji Fisher added 20 commits

    added 20 commits

    • cb322a9a...f988abcf - 3 commits from branch project:4.x
    • f988abcf...a867dd42 - 7 earlier commits
    • 1c5361c8 - Keep stylelint happy
    • b90ef0ac - Update baseline for phpstan
    • e6b6b699 - Addressed Eslint error/warnings
    • 1d5c0894 - Fixed all Eslint warnings / errors
    • ca9a6d15 - Update tests to use lowerCamelCase properties of the non-test classes
    • cea59723 - Let DrupalCI decide where the Drupal root is (PHPStan)
    • 5dc2ce16 - Tell phpcs to ignore a line that is commented out
    • 9b0c90b9 - Apply new automated fixes from phpcbf
    • 0753f82b - Fix comment formatting to keep phpcs happy
    • b33394ec - Add a missing @param comment

    Compare with previous version

  • Benji Fisher added 2 commits

    added 2 commits

    • 215ac083 - Fix some more comment formatting
    • 2c33b973 - Fix spelling errors and set a baseline for cspell

    Compare with previous version

  • Benji Fisher added 1 commit

    added 1 commit

    • fd3b9882 - Restore lower-case true, false in JS

    Compare with previous version

  • added 1 commit

    • 5371224f - revert JS changes so we can keep moving on the rest of Gitlab integration

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Lucas Hedding added 3 commits

    added 3 commits

    • 8d14587e...e6acb955 - 2 commits from branch project:4.x
    • 1c142618 - Merge remote-tracking branch 'origin/4.x' into 3423942-gitlab-ci-testing

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading