mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 05:01:14 +08:00
DEV: Load client site settings YML into JS tests (#18413)
Our method of loading a subset of client settings into tests via tests/helpers/site-settings.js can be improved upon. Currently we have a hardcoded subset of the client settings, which may get out of date and not have the correct defaults. As well as this plugins do not get their settings into the tests, so whenever you need a setting from a plugin, even if it has a default, you have to do needs.setting({ ... }) which is inconvenient. This commit introduces an ember CLI build step to take the site_settings.yml and all the plugin settings.yml files, pull out the client settings, and dump them into a variable in a single JS file we can load in our tests, so we have the correct selection of settings and default values in our JS tests. It also fixes many, many tests that were operating under incorrect assumptions or old settings. Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
@ -49,7 +49,7 @@ acceptance("Local Dates - quoting", function (needs) {
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
|
||||
[/quote]`,
|
||||
"converts the date to markdown with all options correctly"
|
||||
@ -88,7 +88,7 @@ acceptance("Local Dates - quoting range", function (needs) {
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
|
||||
[/quote]`,
|
||||
"converts the date range to markdown with all options correctly"
|
||||
@ -130,7 +130,7 @@ acceptance(
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
||||
|
||||
Testing recurring [date=2022-06-22 timezone="Australia/Brisbane" recurring="2.weeks"]
|
||||
|
Reference in New Issue
Block a user