Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encapsulate check for components support in method #5328

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

romaricpascal
Copy link
Member

@romaricpascal romaricpascal commented Sep 16, 2024

This will allow subclasses of GOVUKFrontendComponent to override when components are supported, possibly combining it with when GOV.UK Frontend itself is supported.

No CHANGELOG entry as it will only be public with #5327, for which we'll want a unique entry.

Closes #5323

…omponent`

This will allow subclasses to override when components are supported, possibly combining it with when GOV.UK Frontend itself is supported
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-5328 September 16, 2024 15:50 Inactive
Copy link

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 118.52 KiB
dist/govuk-frontend-development.min.js 44.6 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 94.18 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 88.43 KiB
packages/govuk-frontend/dist/govuk/all.mjs 1.1 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 1.29 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 118.5 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 44.59 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB
packages/govuk-frontend/dist/govuk/init.mjs 6.9 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 84.57 KiB 42.37 KiB
accordion.mjs 25 KiB 12.94 KiB
button.mjs 7.48 KiB 3.24 KiB
character-count.mjs 23.9 KiB 10.47 KiB
checkboxes.mjs 7.34 KiB 3.38 KiB
error-summary.mjs 9.39 KiB 4 KiB
exit-this-page.mjs 18.61 KiB 9.81 KiB
header.mjs 5.97 KiB 3.15 KiB
notification-banner.mjs 7.76 KiB 3.17 KiB
password-input.mjs 16.64 KiB 7.8 KiB
radios.mjs 6.33 KiB 2.92 KiB
service-navigation.mjs 5.95 KiB 3.24 KiB
skip-link.mjs 5.89 KiB 2.73 KiB
tabs.mjs 11.55 KiB 6.61 KiB

View stats and visualisations on the review app


Action run for 416cfbc

Copy link

JavaScript changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
index 69008e86f..19e286ee0 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.js
@@ -136,7 +136,10 @@ class GOVUKFrontendComponent {
             }(e, t)) throw new InitError(t)
     }
     checkSupport() {
-        if (!isSupported()) throw new SupportError
+        if (!this.isSupported()) throw new SupportError
+    }
+    isSupported() {
+        return isSupported()
     }
 }
 class I18n {

Action run for 416cfbc

Copy link

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/all.bundle.js b/packages/govuk-frontend/dist/govuk/all.bundle.js
index f4c1a5628..1c67edb22 100644
--- a/packages/govuk-frontend/dist/govuk/all.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/all.bundle.js
@@ -266,10 +266,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/all.bundle.mjs b/packages/govuk-frontend/dist/govuk/all.bundle.mjs
index 8e29d1ad1..f8c1c3ed1 100644
--- a/packages/govuk-frontend/dist/govuk/all.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/all.bundle.mjs
@@ -260,10 +260,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
index 1ea530bf9..0b96e7125 100644
--- a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js
@@ -200,10 +200,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
index 941d494c1..4c4530f84 100644
--- a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs
@@ -194,10 +194,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
index 7c75d4d98..07424eb65 100644
--- a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.js
@@ -200,10 +200,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
index fc488920a..d9412f41d 100644
--- a/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/button/button.bundle.mjs
@@ -194,10 +194,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
index 92e9f8559..76ce4eea5 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
@@ -231,10 +231,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
index bf3f2865c..34ee63460 100644
--- a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs
@@ -225,10 +225,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
index 459b25eda..b77f9b743 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js
@@ -111,10 +111,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
index 49bdeba72..e3c1fd925 100644
--- a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs
@@ -105,10 +105,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
index 11dde3fc3..99c71b5ff 100644
--- a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
@@ -230,10 +230,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
index 32d877a4b..8600154f1 100644
--- a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
@@ -224,10 +224,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
index db5ac14ff..fb4533397 100644
--- a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
@@ -200,10 +200,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
index bca3e20dd..714daefad 100644
--- a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
@@ -194,10 +194,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
index 2977098ff..5bbcbe1be 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.js
@@ -119,10 +119,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
index 81aa86e4b..224c11925 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/header/header.bundle.mjs
@@ -113,10 +113,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
index 9fe1ed201..6a44dd11c 100644
--- a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js
@@ -224,10 +224,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
index 816f0c522..7b0c12d39 100644
--- a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs
@@ -218,10 +218,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
index ad6b0bcae..38adb9a52 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js
@@ -205,10 +205,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
index 75dd1d46e..a0465d235 100644
--- a/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
@@ -199,10 +199,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
index eb9602c40..7444eea07 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.js
@@ -111,10 +111,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
index 61a06be92..1fd810d35 100644
--- a/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs
@@ -105,10 +105,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
index 18831fdb6..09499031c 100644
--- a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js
@@ -119,10 +119,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
index 99a6ff9f7..c944b0639 100644
--- a/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs
@@ -113,10 +113,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
index 9103ddf5f..29e6e9727 100644
--- a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js
@@ -141,10 +141,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
index 49a20e142..b5b902021 100644
--- a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs
@@ -135,10 +135,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
index 64f4c4c80..3400748c8 100644
--- a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
+++ b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js
@@ -125,10 +125,20 @@
       }
     }
     checkSupport() {
-      if (!isSupported()) {
+      if (!this.isSupported()) {
         throw new SupportError();
       }
     }
+
+    /**
+     * Defines whether the components are supported
+     *
+     * @protected
+     * @returns {boolean} whether the components are supported
+     */
+    isSupported() {
+      return isSupported();
+    }
   }
 
   /**
diff --git a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
index d1da839a3..fb5ce2526 100644
--- a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
+++ b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs
@@ -119,10 +119,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**
diff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs b/packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs
index dac155c9c..2bf203f9d 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs
@@ -19,10 +19,20 @@ class GOVUKFrontendComponent {
     }
   }
   checkSupport() {
-    if (!isSupported()) {
+    if (!this.isSupported()) {
       throw new SupportError();
     }
   }
+
+  /**
+   * Defines whether the components are supported
+   *
+   * @protected
+   * @returns {boolean} whether the components are supported
+   */
+  isSupported() {
+    return isSupported();
+  }
 }
 
 /**

Action run for 416cfbc

@romaricpascal romaricpascal marked this pull request as ready for review September 16, 2024 15:56
@patrickpatrickpatrick
Copy link
Contributor

Looks good to me! Were we going to add changelog entries going forward or are we going to to do it when we merge this branch into main at the end?

@romaricpascal
Copy link
Member Author

Looks good to me! Were we going to add changelog entries going forward or are we going to to do it when we merge this branch into main at the end?

At the moment, this is only an internal refactoring, as GOVUKFrontendComponent is still internal, so no changelog entry is needed. #5327 will be the one adding a CHANGELOG entry, as that's when we'll give access to the base class proper. We'll need to discuss then how much content goes in the changelog and how much we just have as links to the Frontend docs.

@patrickpatrickpatrick
Copy link
Contributor

Looks good to me! Were we going to add changelog entries going forward or are we going to to do it when we merge this branch into main at the end?

At the moment, this is only an internal refactoring, as GOVUKFrontendComponent is still internal, so no changelog entry is needed. #5327 will be the one adding a CHANGELOG entry, as that's when we'll give access to the base class proper. We'll need to discuss then how much content goes in the changelog and how much we just have as links to the Frontend docs.

Neat, that makes sense! Approved!

@romaricpascal romaricpascal merged commit 3a651ba into public-js-api Sep 17, 2024
50 checks passed
@romaricpascal romaricpascal deleted the protected-base-issupported branch September 17, 2024 14:50
@romaricpascal romaricpascal linked an issue Sep 17, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a isSupported @protected method to GOVUKFrontendComponent
3 participants