Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82212

Provide a mechanism to deprecate and detect deprecated icons

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-82212-main
    • Hide

      Setup

      1. Apply the MDL-82212-testing-icon-deprecation.patch patch (this will add a few deprecated icons)

        git apply MDL-82212-testing-icon-deprecation.patch

      Testing scenario 1: Visual test

      1. Login as admin.
      2. Go to Administration > Development > Debugging and enable Display debug messages.
      3. Go to Administration > Development > Purge caches , check All MUC caches and purge them.
      4. Open the browser console.
      5. Confirm there are, at least, 2 deprecated icon warnings:

        Deprecated icon found: icon  deprecated deprecated-core:a/em1_bwgreater
        Deprecated icon found: icon fa fa-comment-o deprecated deprecated-core:t/message fa-fw 

      Testing scenario 2: Behat checker for deprecated icons

      1. Initialise behat without the new --no-icon-deprecations flag:

        php admin/tool/behat/cli/init.php
        

      2. Run the following behat scenario:

        php admin/tool/behat/cli/run.php --name="There is no search if I am not enrolled in any course"
        

      3. Confirm that you see the following output at the top:

        Run optional tests:
        - Accessibility: Yes
        - SCSS deprecations: No
        - Icon deprecations: Yes 

      4. Confirm that the test fails:

        Scenario: There is no search if I am not enrolled in any course # blocks/myoverview/tests/behat/block_myoverview_search.feature:41
              When I am on the "My courses" page logged in as "student2"    # blocks/myoverview/tests/behat/block_myoverview_search.feature:42
                Deprecated icon in use. Enable $CFG->debugdisplay for detailed debugging information in the console (Exception)

      5. Run the following behat scenario:

        php admin/tool/behat/cli/run.php --name="Student can favourite a discussion from within an individual discussion"
        

      6. Confirm that the test fails too.

       

      Testing scenario 3: Behat without checking deprecated icons

      1. Re-initialise behat with the --no-icon-deprecations flag:

        php admin/tool/behat/cli/init.php --no-icon-deprecations
        

      2. Run the following behat scenario:

        php admin/tool/behat/cli/run.php --name="There is no search if I am not enrolled in any course"
        

      3. Confirm that you see the following output at the top:

        Run optional tests:
        - Accessibility: Yes
        - SCSS deprecations: No
        - Icon deprecations: No 

      4. Confirm that the test passes without errors.
      5. Run the following behat scenario:

        php admin/tool/behat/cli/run.php --name="Student can favourite a discussion from within an individual discussion"
        

      6. Confirm that the test passes too.
      Show
      Setup Apply the MDL-82212-testing-icon-deprecation.patch patch (this will add a few deprecated icons) git apply MDL-82212-testing-icon-deprecation.patch Testing scenario 1: Visual test Login as admin. Go to Administration > Development > Debugging  and enable Display debug messages. Go to Administration > Development > Purge caches , check All MUC caches and purge them. Open the browser console. Confirm there are, at least, 2 deprecated icon warnings: Deprecated icon found: icon  deprecated deprecated-core:a/em1_bwgreater Deprecated icon found: icon fa fa-comment-o deprecated deprecated-core:t/message fa-fw  Testing scenario 2: Behat checker for deprecated icons Initialise behat without the new --no-icon-deprecations flag: php admin/tool/behat/cli/init.php Run the following behat scenario: php admin/tool/behat/cli/run.php --name="There is no search if I am not enrolled in any course" Confirm that you see the following output at the top: Run optional tests: - Accessibility: Yes - SCSS deprecations: No - Icon deprecations: Yes Confirm that the test fails: Scenario: There is no search if I am not enrolled in any course # blocks/myoverview/tests/behat/block_myoverview_search.feature: 41       When I am on the "My courses" page logged in as "student2"    # blocks/myoverview/tests/behat/block_myoverview_search.feature: 42         Deprecated icon in use. Enable $CFG->debugdisplay for detailed debugging information in the console (Exception) Run the following behat scenario: php admin/tool/behat/cli/run.php --name="Student can favourite a discussion from within an individual discussion" Confirm that the test fails too.   Testing scenario 3: Behat without checking deprecated icons Re-initialise behat with the --no-icon-deprecations flag: php admin/tool/behat/cli/init.php --no-icon-deprecations Run the following behat scenario: php admin/tool/behat/cli/run.php --name="There is no search if I am not enrolled in any course" Confirm that you see the following output at the top: Run optional tests: - Accessibility: Yes - SCSS deprecations: No - Icon deprecations: No Confirm that the test passes without errors. Run the following behat scenario: php admin/tool/behat/cli/run.php --name="Student can favourite a discussion from within an individual discussion" Confirm that the test passes too.
    • 5
    • HQ 2024 Sprint I3.1 Moppies

      While working on MDL-77754 to improve the Font Awesome icons and take advantage of the new ones in 6, a few icons have been marked as candidates for being deprecated because:

       

      A deprecation mechanism should be defined and implemented for icons, to help developers to detect them.

      This mechanism, similar to what was done in MDL-78334 for CSS:

      • Add a method, get_deprecated_icons(), to icon_system to return an array with the deprecated key icons (for instance, core:a/download_all):

        public function get_deprecated_icons(): array {
            return [
                'core_a/download_all';
            ];
        }
        

      • Implement this method in the icon_system_fontawesome class.
      • Use the same methodology in MDL-78334 for CSS, to identify where someone uses a deprecated icon. Make the duplication warning optional using debug developer mode.
      • Add some JS snippet run in the footer when debug developer mode is enabled, to display a console warning for deprecated icons:

        document.querySelectorAll('.icon.deprecated').forEach((icon) => {
            window.console.warn("Deprecated icon found: " + icon.className);
        });

      • Document it in devdocs.

        1. MDL-82212-1.png
          MDL-82212-1.png
          214 kB
        2. MDL-82212 - 2.png
          MDL-82212 - 2.png
          180 kB
        3. MDL-82212 - 3.png
          MDL-82212 - 3.png
          158 kB
        4. MDL-82212-testing-icon-deprecation.patch
          2 kB

            sarjona Sara Arjona (@sarjona)
            sarjona Sara Arjona (@sarjona)
            Mikel Martín Corrales Mikel Martín Corrales
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 43 minutes
                2d 43m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.