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

Provide a mechanism to deprecate and detect deprecated CSS

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_404_STABLE
    • MDL-78334-main
    • Hide

      Setup

      1. Apply the MDL-78334-testing.patch patch (This will add an usage of the deprecated styles)

        git apply MDL-78334-testing.patch

      Theme designer mode visual test

      1. Go to Administration > Appearance > Themes > Theme settings
      2. Enable Theme designer mode
      3. Access a course
      4. Confirm "Hello world" content is displayed with a dotted red border and red background
      5. Confirm "Hello world" content also contains the following text: "Deprecated styles in use"

      Behat checker test

      1. Initialise behat without the new --scss-deprecations flag:

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

      2. Run behat using a course specific scenario:

        php admin/tool/behat/cli/run.php --name="Teacher can see the activity type tooltip only while editing."
        

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

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

        2. Confirm that the test passes
      3. Re-initialise behat with the --scss-deprecations flag:

        php admin/tool/behat/cli/init.php --scss-deprecations
        

      4. Run behat using a course specific scenario:

        php admin/tool/behat/cli/run.php --name="Teacher can see the activity type tooltip only while editing."
        

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

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

        2. Confirm that the test fails with the following output:

          001 Scenario: Teacher can see the activity type tooltip only while editing. #<yoursite>/moodle/course/format/tests/behat/activity_icon_tooltip.feature:26
                Given I am on the "C1" "Course" page logged in as "teacher1"          #<yoursite>/moodle/course/format/tests/behat/activity_icon_tooltip.feature:27
                  Deprecated style in use (Exception)
           
          1 scenario (1 failed)
          14 steps (4 passed, 1 failed, 9 skipped)
          0m12.11s (84.58Mb)
          

      5. Run behat using a course specific scenario without @javascript

        php admin/tool/behat/cli/run.php --name="Teacher should see the automatic completion criterias of activities"

      6. Confirm that the test passes without errors
      Show
      Setup Apply the MDL-78334-testing.patch patch (This will add an usage of the deprecated styles) git apply MDL-78334-testing.patch Theme designer mode visual test Go to Administration > Appearance > Themes > Theme settings Enable Theme designer mode Access a course Confirm "Hello world" content is displayed with a dotted red border and red background Confirm "Hello world" content also contains the following text: "Deprecated styles in use" Behat checker test Initialise behat without the new --scss-deprecations flag: php admin/tool/behat/cli/init.php Run behat using a course specific scenario: php admin/tool/behat/cli/run.php --name="Teacher can see the activity type tooltip only while editing." Confirm that you see the following output at the top: Run optional tests: - Accessibility: No - SCSS deprecations: No Confirm that the test passes Re-initialise behat with the --scss-deprecations flag: php admin/tool/behat/cli/init.php --scss-deprecations Run behat using a course specific scenario: php admin/tool/behat/cli/run.php --name="Teacher can see the activity type tooltip only while editing." Confirm that you see the following output at the top: Run optional tests: - Accessibility: No - SCSS deprecations: Yes Confirm that the test fails with the following output: 001 Scenario: Teacher can see the activity type tooltip only while editing. #<yoursite>/moodle/course/format/tests/behat/activity_icon_tooltip.feature:26 Given I am on the "C1" "Course" page logged in as "teacher1" #<yoursite>/moodle/course/format/tests/behat/activity_icon_tooltip.feature:27 Deprecated style in use (Exception)   1 scenario (1 failed) 14 steps (4 passed, 1 failed, 9 skipped) 0m12.11s (84.58Mb) Run behat using a course specific scenario without @javascript php admin/tool/behat/cli/run.php --name="Teacher should see the automatic completion criterias of activities" Confirm that the test passes without errors
    • HQ 2023 Sprint I4.1 Moppies

      This has come up in the context of migrating to BS5.

      At the moment we have a huge amount of CSS which has been carried through from older versions of Moodle. Unfortunately it is very difficult to detect unused CSS in Moodle, and also rather tricky to inform people that a style is deprecated.

      There are a couple of pieces to solving this:

      1. policy
      2. finding a way to deprecate content (technical perspective)
      3. finding a way to detect uses of deprecated styles

      Policy

      I would suggest that we follow the same policies we have for the rest of Moodle

      Technical deprecation

      There are a couple of ways we can do this, the one that springs to mind is:

      1. move deprecated scss into a new deprecated.scss style
      2. apply a mixin to all deprecated styles which applies only in themedesigner mode to:
        1. applies a thick border
        2. applies a obvious background colour
      3. have another mixin applied which applies to behat to add text content such as:

        &&::before {
          content: "Deprecated style in use";
        }
        

      4. Add to our existing check for exceptions to search for deprecated styles too

      In some cases we may decide tht we just want to be ruthless about gutting some of the older styles and ignore the deprecation process. Some of these things have been useless for over a decade.

            mikelmartíncorrales Mikel Martín Corrales
            dobedobedoh Andrew Lyons
            Laurent David Laurent David
            Ferran Recio Ferran Recio
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            4 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 7 hours, 2 minutes
                3d 7h 2m

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