discourse/spec/lib
Osama Sayegh cd24eff5d9
FEATURE: Introduce theme/component QUnit tests (take 2) (#12661)
This commit allows themes and theme components to have QUnit tests. To add tests to your theme/component, create a top-level directory in your theme and name it `test`, and Discourse will save all the files in that directory (and its sub-directories) as "tests files" in the database. While tests files/directories are not required to be organized in a specific way, we recommend that you follow Discourse core's tests [structure](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/tests).

Writing theme tests should be identical to writing plugins or core tests; all the `import` statements and APIs that you see in core (or plugins) to define/setup tests should just work in themes.

You do need a working Discourse install to run theme tests, and you have 2 ways to run theme tests:

* In the browser at the `/qunit` route. `/qunit` will run tests of all active themes/components as well as core and plugins. The `/qunit` now accepts a `theme_name` or `theme_url` params that you can use to run tests of a specific theme/component like so: `/qunit?theme_name=<your_theme_name>`.

* In the command line using the `themes:qunit` rake task. This take is meant to run tests of a single theme/component so you need to provide it with a theme name or URL like so: `bundle exec rake themes:qunit[name=<theme_name>]` or `bundle exec rake themes:qunit[url=<theme_url>]`.

There are some refactors to how Discourse processes JavaScript that comes with themes/components, and these refactors may break your JS customizations; see https://meta.discourse.org/t/upcoming-core-changes-that-may-break-some-themes-components-april-12/186252?u=osama for details on how you can check if your themes/components are affected and what you need to do to fix them.

This commit also improves theme error handling in Discourse. We will now be able to catch errors that occur when theme initializers are run and prevent them from breaking the site and other themes/components.
2021-04-12 15:02:58 +03:00
..
backup_restore FIX: Remap old S3 endpoints during backup restore (#12276) 2021-03-03 21:10:09 +01:00
compression DEV: Split max decompressed setting for themes and backups (#8179) 2019-10-11 14:38:10 -03:00
content_security_policy FIX: Allow CSP to work correctly for non-default hostnames/schemes (#9180) 2020-03-19 19:54:42 +00:00
i18n FEATURE: Add English (UK) as locale (#11768) 2021-01-20 21:32:22 +01:00
imap/providers FEATURE: IMAP delete email sync for group inboxes (#10392) 2020-08-12 10:16:26 +10:00
seed_data DEV: Add rubocop-rspec (#9288) 2020-03-27 17:35:40 +01:00
site_settings FEATURE: Rename 'Discourse SSO' to DiscourseConnect (#11978) 2021-02-08 10:04:33 +00:00
validators FEATURE: Add timezone to core user_options (#8380) 2019-11-25 10:49:27 +10:00
webauthn SECURITY: 2FA with U2F / TOTP 2020-01-15 11:27:12 +01:00
bookmark_manager_spec.rb FEATURE: Bookmark pinning (#12431) 2021-03-22 09:50:22 +10:00
bookmark_query_spec.rb FEATURE: Bookmark pinning (#12431) 2021-03-22 09:50:22 +10:00
bookmark_reminder_notification_handler_spec.rb FIX: Ensure topic user bookmarked synced on bookmark auto-delete (#10323) 2020-07-29 09:43:32 +10:00
browser_detection_spec.rb FIX: Detect DiscourseHub user agent. 2019-08-09 11:58:15 +03:00
content_security_policy_spec.rb FEATURE: Implement nonces for Google Tag Manager integration (#12531) 2021-03-26 11:19:31 -04:00
db_helper_spec.rb FEATURE: Include optimized thumbnails for topics (#9215) 2020-05-05 09:07:50 +01:00
discourse_js_processor_spec.rb Support for transpiling `.js` files (#9160) 2020-03-11 09:43:55 -04:00
encodings_spec.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
introduction_updater_spec.rb FIX: replace default welcome topic post with new value from wizard 2020-04-01 15:42:45 -04:00
mini_sql_multisite_connection_spec.rb DEV: upgrade mini_sql (#12465) 2021-03-24 08:48:04 +11:00
search_spec.rb FEATURE: Add English (UK) as locale (#11768) 2021-01-20 21:32:22 +01:00
shrink_uploaded_image_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
theme_flag_modifier_spec.rb FEATURE: Allow themes to specify modifiers in their about.json file (#9097) 2020-03-11 13:30:45 +00:00
theme_javascript_compiler_spec.rb FEATURE: Introduce theme/component QUnit tests (take 2) (#12661) 2021-04-12 15:02:58 +03:00
topic_upload_security_manager_spec.rb DEV: Clean up S3 specs, stubs, and helpers 2020-09-28 12:02:25 +01:00
upload_creator_spec.rb FIX: Be able to handle long file extensions (#12375) 2021-03-17 12:01:29 -06:00
upload_recovery_spec.rb DEV: Recover missing files of existing uploads (#10757) 2020-10-01 14:54:45 +02:00
upload_security_spec.rb FIX: Do not mark group_flair images as secure on upload (#12081) 2021-02-16 12:34:03 +10:00