Skip to content
Snippets Groups Projects
Verified Commit 747c8660 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3428652 by nod_, jmaxant, alexpott, prashant.c, godotislate,...

Issue #3428652 by nod_, jmaxant, alexpott, prashant.c, godotislate, UserOne.se, smustgrave: Broken auto creation of machine name field

(cherry picked from commit 73ec2854)
parent 20f60160
Branches
Tags
10 merge requests!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #261222 passed with warnings
Pipeline: drupal

#261250

    Pipeline: drupal

    #261240

      Pipeline: drupal

      #261231

        ......@@ -28,7 +28,7 @@
        "once": true,
        "CKEditor5": true,
        "tabbable": true,
        "slugify": true,
        "transliterate": true,
        "bodyScrollLock" : true,
        "FloatingUIDOM": true
        },
        ......
        ......@@ -5,7 +5,7 @@
        * @internal
        */
        (function ($, Drupal, drupalSettings, slugify) {
        (function ($, Drupal, drupalSettings, transliterateLibrary) {
        /**
        * Trims string by a character.
        *
        ......@@ -294,21 +294,17 @@
        drupalSettings.transliteration_language_overrides[
        drupalSettings.langcode
        ];
        const normalizedLanguageOverrides = {};
        const replace = {};
        if (languageOverrides) {
        Object.keys(languageOverrides).forEach((key) => {
        // Updates the keys from hexadecimal to strings.
        normalizedLanguageOverrides[String.fromCharCode(key)] =
        languageOverrides[key];
        replace[String.fromCharCode(key)] = languageOverrides[key];
        });
        }
        slugify.config({
        separator: settings.replace,
        allowedChars: settings.replace_pattern,
        replace: normalizedLanguageOverrides,
        });
        return prepareMachineName(slugify(source), settings);
        const transliteratedSource = transliterateLibrary(source, { replace });
        return prepareMachineName(transliteratedSource, settings);
        },
        };
        })(jQuery, Drupal, drupalSettings, slugify);
        })(jQuery, Drupal, drupalSettings, transliterate);
        ......@@ -61,8 +61,7 @@ public function testMachineNameTransliterations($langcode, $input, $output): voi
        $this->drupalGet("/admin/people/roles/add");
        $page->find('css', '[data-drupal-selector="edit-label"]')->setValue($input);
        $this->assertSession()->pageTextContains($output);
        $this->assertSession()->elementTextEquals('css', 'span.machine-name-value', $output);
        }
        /**
        ......@@ -78,13 +77,13 @@ public static function machineNameInputOutput(): array {
        ['de', 'Äwesome', 'aewesome'],
        ['da', 'äöüåøhello', 'aouaaoehello'],
        ['fr', 'ц', 'c'],
        // These tests are not working with chromedriver as
        // 'ᐑ','𐌰𐌸' chars are not accepted.
        // ['fr', 'ᐑ', 'wii'],
        ['fr', 'ᐑ', 'wii'],
        // This test is not working with chromedriver as '𐌰𐌸' chars are not
        // accepted.
        // ['en', '𐌰𐌸', '__'],
        ['en', 'Ä Ö Ü Å Ø äöüåøhello', 'a_o_u_a_o_aouaohello'],
        ['de', 'Ä Ö Ü Å Ø äöüåøhello', 'ae_oe_ue_a_o_aeoeueaohello'],
        ['de', ']URY&m_G^;', ' ury_m_g'],
        ['de', ']URY&m_G^;', 'ury_m_g'],
        ['da', 'Ä Ö Ü Å Ø äöüåøhello', 'a_o_u_aa_oe_aouaaoehello'],
        ['kg', 'ц', 'ts'],
        ['en', ' Hello Abventor! ', 'hello_abventor'],
        ......
        ......@@ -2,42 +2,42 @@
        const MachineNameTestArray = [
        {
        machineName: 'Bob',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'bob',
        },
        {
        machineName: 'Äwesome',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'awesome',
        },
        {
        machineName: 'B?!"@\\/-ob@e',
        replacePattern: 'a-zA-Z0-9_.~',
        replacePattern: '[^a-zA-Z0-9_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'b_ob_e',
        },
        {
        machineName: 'Bob@e\\0',
        replacePattern: 'a-zA-Z0-9_.~@',
        replacePattern: '[^a-zA-Z0-9_.~@]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'bob@e_0',
        },
        {
        machineName: 'Bobby',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'bobby',
        },
        {
        machineName: 'ǍǎǏ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aai',
        ......@@ -46,140 +46,140 @@ const MachineNameTestArray = [
        // the removeDiacritics() function present in PhpTranliteration.php.
        {
        machineName: 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aaaaaaaeceeeeiiii',
        },
        {
        machineName: 'ÐÑÒÓÔÕÖרÙÚÛÜÝÞß',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'dnoooooxouuuuuthss',
        },
        {
        machineName: 'àáâãäåæçèéêëìíîï',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aaaaaaaeceeeeiiii',
        },
        {
        machineName: 'ðñòóôõö÷øùúûüýþÿ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'dnooooo_ouuuuythy',
        },
        {
        machineName: 'ĀāĂ㥹ĆćĈĉĊċČčĎď',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aaaaaaccccccccdd',
        },
        {
        machineName: 'ĐđĒēĔĕĖėĘęĚěĜĝĞğ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'ddeeeeeeeeeegggg',
        },
        {
        machineName: 'ĠġĢģĤĥĦħĨĩĪīĬĭĮį',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'gggghhhhiiiiiiii',
        },
        {
        machineName: 'İıIJijĴĵĶķĸĹĺĻļĽľĿ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'iiijijjjkkklllllll',
        },
        {
        machineName: 'ŀŁłŃńŅņŇňʼnŊŋŌōŎŏ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'lllnnnnnn_nngngoooo',
        },
        {
        machineName: 'ŐőŒœŔŕŖŗŘřŚśŜŝŞş',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'oooeoerrrrrrssssss',
        },
        {
        machineName: 'ŠšŢţŤťŦŧŨũŪūŬŭŮů',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'ssttttttuuuuuuuu',
        },
        {
        machineName: 'ŰűŲųŴŵŶŷŸŹźŻżŽž',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'uuuuwwyyyzzzzzz',
        },
        {
        machineName: 'ǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'ioouuuuuuuuuu_aa',
        },
        {
        machineName: 'ǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aaaeaeggggkkoooozhzh',
        },
        {
        machineName: 'ǰDZDzdzǴǵǶǷǸǹǺǻǼǽǾǿ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'jdzddzgghvwnnaaaeaeoo',
        },
        {
        machineName: 'ȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'aaaaeeeeiiiioooo',
        },
        {
        machineName: 'ȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'rrrruuuussttyyhh',
        },
        {
        machineName: 'ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'ndououzzaaeeoooooo',
        },
        {
        machineName: 'ȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'ooyylntjdbqpacclts',
        },
        {
        machineName: 'ɀɁɂɃɄɅɆɇɈɉɊɋɌɍɎɏ',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'z_buveejjqqrryy',
        ......@@ -187,25 +187,39 @@ const MachineNameTestArray = [
        // Test for maximum length of machine-name
        {
        machineName: 'This is the test for max length',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 20,
        expectedMachineName: 'this_is_the_test_for',
        },
        {
        machineName: 'Ma@Chi!~',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '_',
        maxlength: 5,
        expectedMachineName: 'ma_ch',
        },
        {
        machineName: 'Test for custom replace character',
        replacePattern: 'a-zA-Z0-9-_.~',
        replacePattern: '[^a-zA-Z0-9-_.~]+',
        replaceChar: '-',
        maxlength: 64,
        expectedMachineName: 'test-for-custom-replace-character',
        },
        {
        machineName: 'Test for unusual replace pattern',
        replacePattern: '([^a-z0-9_]+)|(^custom$)',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: 'test_for_unusual_replace_pattern',
        },
        {
        machineName: 'custom',
        replacePattern: '([^a-z0-9_]+)|(^custom$)',
        replaceChar: '_',
        maxlength: 64,
        expectedMachineName: '_',
        },
        // cSpell:enable
        ];
        module.exports = {
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment