Commit Graph

23 Commits

Author SHA1 Message Date
324aa3eb61 REFACTOR: reworks all the search-advanced-options panel (#10661)
* REFACTOR: reworks all the search-advanced-options panel

This commit includes the following changes:
- prevents any mutation of external (to the component) values
- get rid of observers
- uses @action
- minor UI tweaks
- dropped the unecessary debounce
- drops all the legacy code for badges/groups which is not being used
- replaces user-selector by user-chooser and improves multi-select to not show `search` if maximum has been reached

Most importantly this refactor should fix multiple bugs due to _update() being called multiple times if searchTerm was empty and other various bugs where some changes in searchTerm was not applied to the sidebar.
2020-09-15 09:39:12 +02:00
52672b9eab DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
66021abe41 REFACTOR: Remove _.first from codebase 2020-09-03 10:03:33 -04:00
ff4de97dfd REFACTOR: Move bootbox to an import instead of global variable (#10533) 2020-08-26 12:57:13 -04:00
71e747b160 FIX: QUnit site has to be set before reset() 2020-08-25 09:16:32 -04:00
a3fb732b23 REFACTOR: We can reuse getOwner for some container stuff 2020-08-25 09:16:32 -04:00
347a4981a0 REFACTOR: Remove Discourse constant from get-owner 2020-08-25 09:16:32 -04:00
02e8d84e30 REFACTOR: Remove Discourse constant from showModal 2020-08-25 09:16:32 -04:00
98e5e1cd53 REFACTOR: Remove container from DiscourseURL 2020-08-25 09:16:32 -04:00
3640c00b03 Remove Discourse constant usage (#10470)
* REFACTOR: Get us closer to no `Discourse` constants in tests

* REFACTOR: Remove `Discourse.currentUser`

* REFACTOR: `prioritizeNameInUx` is really a helper and can use context

* REFACTOR: Rename test

* REFACTOR: Remove `Discourse.MarkdownItURL` and use session

* REFACTOR: Remove unused `LetterAvatarVersion`

* REFACTOR: Remove unused `Discourse.ThemeSettings`

* REFACTOR: Remove unused CDN constants

* REFACTOR: The `globalNotice` property doesn't exist anymore

* REFACTOR: Remove `Discourse.__container__` from plugin api

* REFACTOR: Consider `logout()` a helper and remove container.
2020-08-19 08:51:48 -04:00
c2276f0b7e DEV: add acceptance test for topic list
followup on dc14d156

We previously had no tests and no cleanup
2020-07-31 11:23:12 +10:00
01a3fa1ca8 REFACTOR: Remove Discourse.__container__ from tests 2020-07-28 14:58:31 -04:00
a37a19b55c REFACTOR: Remove less effective method of injecting siteSettings 2020-07-15 11:48:55 -04:00
5b276af921 Remove Discourse.SiteSettings from tests (#10193)
* Remove unused Discourse.SiteSettings

* Remove `Discourse.SiteSettings` from many tests

* REFACTOR: `lib:formatter` was using a lot of leaky state

* Remove more `Discourse.SiteSettings` from tests

* More SiteSettings removed from tests
2020-07-09 15:54:53 -04:00
10384bcdf4 FIX: Flaky tests
Locally I was getting a lot of failures from discourse-encrypt due to
leaky state in composer actions. This fixes it.
2020-07-09 12:58:57 -04:00
8825395bdc DEV: allows to decorate username selector (#9869)
Usage:

```
api.addUsernameSelectorDecorator(username => {
  return iconHTML("calendar-alt");
});
```
2020-05-25 19:09:55 +02:00
0e09c5837f DEV: Try once more to make acceptance test fake timers work
In my original PR (#9647) I attempted to solve the problem of
using fake timers in acceptance tests by using the new sinon
clock.tickAsync methods. This way of doing things seems to be flawed,
however, as we are getting random spec timeouts starting with the
bookmark acceptance test where this was introduced.

I think I was going about things the wrong way. This commit introduces
a new function with callback (acceptanceUseFakeClock) that sets up the
fake timers using sinon.useFakeTimers with the shouldAdvanceTime option
set to true. This advances time at a normal rate of 20ms per tick, which
means that we are not freezing any time and existing setTimeout funcs.
should proceed as normal. Along with this the callback passed will
run clock.reset() at the end to make sure all the timers are cleaned
up correctly.

There is an optional third parameter after the callback, which is the
timezone. If the user is logged in for the acceptance test then their
timezone is used, otherwise we default to America/Denver.

Usage is (inside an acceptance test):

```
test("Name of the test", async assert => {
  // first parameter is time to start fake clock at
  await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
    // test code goes here e.g. await visit("/url");
  });
});
```
2020-05-13 15:16:07 +10:00
7e303f9320 DEV: Upgrade sinon and fix time based bookmark tests (#9647)
Update sinon.js to 9.0.2 to access async fake timers https://sinonjs.org/releases/v9.0.2/fake-timers/ which can then be used with acceptance tests (previously useFakeTimers didn't work with await, e.g. for visit).

Fix the bookmark acceptance test that was time based to use these new fake timers.

Add a fakeTime function that uses moment and the provided date string + timezone to freeze time using useFakeTimers and return a clock.

Add a timeStep function that accepts a clock from fakeTime and a function to run. Once the function is run we call clock.tickAsync(1000) to progress the fake clock forward 1s to progress promises/callbacks.
2020-05-07 09:10:32 +10:00
10f9f295dc DEV: Add acceptance tests for bookmarks with reminders (#9592) 2020-04-30 14:58:26 +10:00
38e347aee6 DEV: allows to decorate topic list item (#9294)
Co-authored-by: David Taylor <david@taylorhq.com>
2020-03-27 16:50:31 +01:00
60df2ade8d Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
4fa580fbd1 Revert "Rename all test files from JS -> ES6"
This reverts commit 2abe85b8344de1102c1589a9ac9421a8b296f2b5.
2020-03-25 16:13:43 -04:00
2abe85b834 Rename all test files from JS -> ES6 2020-03-25 15:03:21 -04:00