Skip to content

Commit

Permalink
Closes #138: Make SCENARIO_URLS dynamic and depending on the runnin…
Browse files Browse the repository at this point in the history
…g test (#141)

* Closes #138: Make `SCENARIO_URLS` dynamic and depending on the running test

* Remove function from config
  • Loading branch information
Miraeld authored Sep 19, 2024
1 parent 3bf80c5 commit a7e0390
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
23 changes: 23 additions & 0 deletions config/scenarioUrls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"test:llcssbg": {
"home": {
"path": ""
},
"llcss": {
"path": "lazyload_css_background_images"
},
"noJsLlcss": {
"path": "lazyload_css_background_images",
"disableJs": true
},
"elementorLlcss": {
"path": "elementor-overlay"
},
"doubleColon": {
"path": "ll_bg_css_double_colon"
},
"singleColon": {
"path": "ll_bg_css_single_colon"
}
}
}
37 changes: 6 additions & 31 deletions config/wp.config.sample.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ScenarioUrls from "./scenarioUrls.json";

/**
* The default WordPress admin user configuration for both local and live environments.
* @constant
Expand Down Expand Up @@ -57,37 +59,10 @@ const {
* }
* }}
*/
const SCENARIO_URLS = {
/**
* The value will hold the url paths
*/
home: {
path: ''
},
llcss: {
path: 'lazyload_css_background_images'
},
noJsLlcss: {
path: 'lazyload_css_background_images',
disableJs: true
},
elementorLlcss: {
path: 'elementor-overlay'
},
delayJs: {
path: ''
},
delayJsMobile: {
path: '',
mobile: true,
},
doubleColon: {
path: 'll_bg_css_double_colon'
},
singleColon: {
path: 'll_bg_css_single_colon'
}
}


const scriptName = process.env.npm_lifecycle_event;
const SCENARIO_URLS = ScenarioUrls[scriptName];

/**
* Exported WordPress environment configuration.
Expand Down

0 comments on commit a7e0390

Please sign in to comment.