This is an automated email from the ASF dual-hosted git repository.

vlamp pushed a commit to branch TAP5-2734
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/TAP5-2734 by this push:
     new 33409c911 TAP5-2734: Enable jquery-migrate via JS infrastructure 
provider setting.
33409c911 is described below

commit 33409c911610d38f319b2c9f78461e25ee0a2be7
Author: Volker Lamp <vl...@apache.org>
AuthorDate: Thu Jul 14 22:20:15 2022 +0200

    TAP5-2734: Enable jquery-migrate via JS infrastructure provider setting.
---
 .../java/org/apache/tapestry5/modules/JavaScriptModule.java   | 11 ++++++++---
 .../apache/tapestry5/integration/app1/services/AppModule.java |  2 +-
 .../integration/app1/services/EnableJQueryModule.java         |  2 +-
 .../apache/tapestry5/integration/app3/services/AppModule.java |  2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
 
b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
index fc8bf840b..04f7d6e97 100644
--- 
a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
+++ 
b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
@@ -179,6 +179,11 @@ public class JavaScriptModule
 
         add(configuration, StackExtensionType.MODULE, "jquery");
         
+        if (provider.equals("jquery-migrate"))
+        {
+               configuration.add("jquery-migrate", 
StackExtension.module("jquery-migrate"));
+        }
+        
         add(configuration, StackExtensionType.STYLESHEET, "${" + 
SymbolConstants.FONT_AWESOME_ROOT + "}/css/font-awesome.css");
 
         if (compatibility.enabled(Trait.BOOTSTRAP_3) && 
compatibility.enabled(Trait.BOOTSTRAP_4))
@@ -427,13 +432,13 @@ public class JavaScriptModule
                                         
                                         Compatibility compatibility,
                                         
-                                        
@Symbol(SymbolConstants.PRODUCTION_MODE) boolean prodMode
+                                        
@Symbol(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER) String provider
                                         )
     {
         // The underscore shim module allows Underscore to be injected
         configuration.add("underscore", new 
JavaScriptModuleConfiguration(underscoreShim));
         configuration.add("jquery", new 
JavaScriptModuleConfiguration(jqueryShim));
-        if (!prodMode)
+        if (provider.equals("jquery-migrate"))
         {              
                configuration.add("jquery-migrate", new 
JavaScriptModuleConfiguration(jqueryMigrate).dependsOn("jquery"));
         }
@@ -516,7 +521,7 @@ public class JavaScriptModule
             configuration.add("t5/core/dom", new 
JavaScriptModuleConfiguration(domPrototype));
         }
 
-        if (provider.equals("jquery"))
+        if (provider.equals("jquery") || provider.equals("jquery-migrate"))
         {
             configuration.add("t5/core/dom", new 
JavaScriptModuleConfiguration(domJQuery));
         }
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
index 5f57836bf..ba016aad8 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
@@ -178,7 +178,7 @@ public class AppModule
         configuration.add(SymbolConstants.HMAC_PASSPHRASE, "testing, testing, 
1... 2... 3...");
 
         // This is the emphasis of testing at this point.
-        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery");
+        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery-migrate");
 
         configuration.add(D3_URL_SYMBOL, 
"cdnjs.cloudflare.com/ajax/libs/d3/3.0.0/d3.js");
         configuration.add(SymbolConstants.PRELOADER_MODE, 
PreloaderMode.ALWAYS);
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/EnableJQueryModule.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/EnableJQueryModule.java
index 2abbe80e8..96bcdf387 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/EnableJQueryModule.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/EnableJQueryModule.java
@@ -14,7 +14,7 @@ public class EnableJQueryModule
     @ApplicationDefaults
     public static void switchProviderToJQuery(MappedConfiguration<String, 
Object> configuration)
     {
-        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery");
+        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery-migrate");
     }
 
     @Contribute(Compatibility.class)
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/services/AppModule.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/services/AppModule.java
index 5319bcc75..bd53bd9ad 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/services/AppModule.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/services/AppModule.java
@@ -57,7 +57,7 @@ public class AppModule
 
         configuration.add(TapestryHttpSymbolConstants.PRODUCTION_MODE, 
"false");
 
-        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery");
+        configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, 
"jquery-migrate");
         
         configuration.add(SymbolConstants.FORM_GROUP_LABEL_CSS_CLASS, 
FORM_GROUP_LABEL_CSS_CLASS_VALUE);
         configuration.add(SymbolConstants.FORM_GROUP_WRAPPER_CSS_CLASS, 
FORM_GROUP_WRAPPER_CSS_CLASS_VALUE);

Reply via email to