This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
David Taylor 84c2c2f477
DEV: Refactor Site creation in tests (#15707)
Previously, `resetSite()` would immediately generate a new `Site` instance, and run all the initialization logic within the model. This included initializing Category objects.

This was problematic because `resetSite()` is called before any initializers have been run. That means that any modifications to the Site or Category classes would not have any effect on the already-initialized Site/Category instances.

This commit makes two main changes so so that the test environment is more production-like:

1. Update `resetSite` so that it simply stores the new data in the PreloadStore, and destroys the old Site instance. Initialization of a new site instance happens 'just in time' (normally during the `inject-discourse-objects` initializer)

2. Update the `helperContext` in tests to use getters. This avoids the need to look up `Site.current()` before initializers have run

It also makes a minor adjustment to one test which was relying on a side-effect of the previous behavior.

This should resolve the failing tests for discourse-category-expert under Ember-CLI: https://github.com/discourse/discourse-category-experts/pull/69
2022-02-03 10:02:47 +00:00
..
app A11Y: Use autocomplete=off more widely (#15780) 2022-02-03 16:16:49 +11:00
config DEV: Allow ember server --environment production to be used (#15431) 2021-12-31 12:26:23 +00:00
lib DEV: Update plugin JS loading in Ember CLI testem environment 2022-01-18 10:16:29 +00:00
public/assets/scripts DEV: Support for running theme test with Ember CLI (third attempt) 2022-01-13 16:02:07 -05:00
tests DEV: Refactor Site creation in tests (#15707) 2022-02-03 10:02:47 +00:00
.ember-cli REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
.npmrc DEV: Prevent npm usage (#13945) 2021-08-04 22:04:58 +02:00
ember-cli-build.js DEV: Remove jQuery UI vendor dependencies (#15700) 2022-01-28 11:21:59 +11:00
package.json PERF: Update ember-auto-import (#15695) 2022-02-03 10:01:59 +00:00
testem.js DEV: Update plugin JS loading in Ember CLI testem environment 2022-01-18 10:16:29 +00:00