* Detect years 0...99 correct.
* Short forms possible: JJJJ, JJJJ-MM, JJJJMM, JJJJMMTT
QUnit Test sorts now with parser 'isoDate' (because of 2009 former test sorts with parser 'text')
* Prefix and postfix allowed.
* Between date and time a 'T' or 'any white space' is allowed (Bug: T126886)
Bug: T126886
Change-Id: I664b4cc9d5fb472ea0bc0e36a3c209f04048e769
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case passing by reference
Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.
See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
is still there in some Edge versions that display mojibake.
Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
- Add sticky preference for groups and the operation behind
it.
- Allow normalization from the UriProcessor
- Backwards-compatibility for saved queries
- Allow saved queries to load regardless of sticky params
and to be compared correctly without the sticky params.
- Add days/limit preferences and update those on change
- Update the preference even if we received a new value
from the URL.
Bug: T171514
Bug: T171368
Change-Id: I5232f3372f0e5c981332d152faf0ab47cc470b56
Follows-up 6418c54c4, 5e602c6132. Missed these because they didn't
match my search pattern previously (I didn't account for the test
name being a variable instead of a string literal.)
Change-Id: Ieae82acc80719041712c8c18b8ddffe387ebe8cf
The group allows filters to be represented 'directly' with their
selected values corresponding to their parameter "1" or "0" value.
Change-Id: I56e9b52ff79a46227de71c905b2ecd97a3823624
* Nested modules:
- Support for Sinon extension was fixed by Ib17bbbef45b2bd.
- Support for Fixture extension was still broken, masked by the use
of a local variable that made the handler not fail when setup ran twice
in a row. Fixed using the same moduleStack.length check.
- Add regression test.
* beforeEach/afterEach:
- Added in 1.16, with compat for setup/teardown.
Our wrapper adds its own setup/teardown, and preserves any original one.
However, it didn't account for beforeEach/afterEach, so it ends up
sending both but only one is used.
- Fix to support both on the incoming localEnv object, and also switch
our wrapper to use beforeEach/afterEach in prep for QUnit 2.0.
- Fix our wrappers to preserve return value since QUnit 2 allows beforeEach
and afterEach hooks to be asynchronous by returning a Promise, similar
to how one can do from QUnit.test().
- Add regression test.
* Centralise makeSafeEnv logic
- We always create our own env object to pass to orgModule().
Document why this is (to avoid recursion).
- Add regression test.
* Custom assertion methods:
- Use this.pushResult instead of the deprecated QUnit.push() method.
This also improves the in-browser reporting of errors by properly
supporting 'negative' results for notHtmlEqual reporter.
Bug: T170515
Change-Id: If4141df10eae55cbe8a5ca7a26707be1cd7b9217
- Add 'hidden' groups that have base defaults but are not
viewed in the filter drop-down.
- Add a UI for days, hours and limit selections, based on their
group models.
- Clean up the fieldset form to remove redundant line breaks
and empty objects.
- Add 'hours' as a subset of days, where the UI can split itself
by picking up values >=1 and <1
- Add the ability to allow 'arbitrary' information from the URL
values, but also make sure there is a validation method
and a possibility to re-sort the values that are added in.
Bug: T162784
Bug: T162786
Change-Id: I8068a7cc411eef40ddb8af4eef1d4f1e5f2a2b82
Follows-up 0a208911a2, which added support for the `executeNow`
parameter to QUnit.module.
To properly support nested modules, we also need to skip registering
a second setup and teardown because nested modules already run the
beforeEach (setup), and afterEach (teardown), of their parent modules.
During setup this would needlessly create two sandboxes and override
the 'sandbox' property on the same 'this' context object. During
teardown it would fail because the inner module's teardown would
have already torn down the sandbox.
Change-Id: Ib17bbbef45b2bd0247979cf0fa8aed17800c54a0
Instead, use assert.async(), or (in this case) return the Promise directly
to QUnit.test, which will naturally await it.
As bonus, it'll handle errors, too. (instead of timing out)
Change-Id: I94ee0bf72a3d8ac2e588cd75cbe0787b5001d5b4
Deprecated since QUnit 1.16, removed in QUnit 2.0. (We're on 1.23 currently.)
Migrate to assert.async().
This is a fairly atypical use of QUnit.start(), because it functions here
as a cross-script callback, where lexical scope cannot be used to share
the async() callback directly.
Other mw.loader tests already solved this by using a static callback instead
which inherits the lexical scope from the test to call done(). The old
'qunitOkCall' script is no longer used after this and thus removed.
Change-Id: I430df14b35a69c71df8685494d1379e22af0d6df
Follows-up If8ff31b530dfbd882. Now that we have resolveStubbornly,
we don't need to filter out unknown modules ahead of time.
Aside from removing the needless filter condition, it also has
the benefit of causing a message to be logged to the console,
which can help discover problems. Previously these were silently
ignored.
Change-Id: I700db4931dfd0a412a8eca66c4a74b8831ab0086
We already skip unknown modules at the top-level, but dependencies
still cause a run-time exception from sortDependencies, resulting
in the entire queue not being loaded.
Bug: T36853
Change-Id: If8ff31b530dfbd8823c47ffd827fcdba807c05b3
Group type that only allows a single option to be selected
from its range of items.
Bonus: Add the ability to have a view that is hidden from
the menus
Bug: T162784
Bug: T162786
Change-Id: Ide93491a49c1405926ac171c7924a469e94c0e0a
- Have the initialization method read filters by views and treat
all filters, regardless of their views, the exact same, including
evaluating their subsets and conflicts.
- Clean up unit test file and make pass with the new initialization.
Change-Id: I200720ffde8ad8ff7a63d0cd82615d358e74949a
Enhanced RCFilters: Add the ability to filter by namespaces to RCFilters.
🎉🎁🎊
- Add the ability to separate groups of filters by 'views'
- Add the first views as 'default' (for predefined filters)
and 'namespace' as the list of namespaces.
- Add 'nsinvert' to namespace group
- Allow highlighting namespaces
- Allow searching on either view, depending on prefix
- Add a way to switch views by typing prefix, clicking the
'Namespaces' button or clicking a tag (either namespace
or filter tag, changes the view accordingly, and adds
or removes the prefix from the input to stay consistent)
- Add an optional wrapper text for tags, so we can represent
them with their respective prefixes and (if needed) with
a special message for inverted state.
- Add unit tests and make pass
- Bonus: Fix issue with URL not updating (and not being updated)
the inverted and highlight enabled states.
Bug: T159942
Bug: T163521
Bug: T164130
Change-Id: I7e83f0800cbeb289dfd3461c1c5a197c053147ca
The backend always merges the query with wiki/user defaults before
it gives us data. The frontend, though, initially assumed that the
state is given strictly by the URL parameters (especially after the
URL shorening commit). This made it so that the frontend state is
incompatible with backend state.
However, always merging frontend state with user/wiki defaults can
produce inconsistencies between URLs in the same wiki, preventing
users from sharing them -- and making it potentially break if ever
a wiki default changes.
The solution is to add 'urlversion=2' to all RCFilters-generated
URLs and have the backend recognize this parameter as 'do not
merge with defaults'.
When RCFilters frontend loads, it checks whether the parameter
exists; if it doesn't, it merges whatever it sees with the defaults
just like the backend, then it transforms the URL to represent the
correct full state, and adds 'urlversion=2' to the URL parameters,
making it consistent across accounts and through time for the
next time it will load.
This means several new behaviors over the 'short url' commit:
- Accessing Special:RecentChanges directly (no query) will result
in one of two things:
-- If there is a saved query that's set to default:
The system will load that saved query "straight forward" (as
if the user clicked that option from the menu) causing, also,
an ajax re-request from the server (since the server does not
yet know about saved queries or their potential for being
the default state.)
-- If there is no saved query default: The system will load
user/wiki defaults (like the backend does) and then fix the
url to represent this state fully (with parameters showing the
actual state of the filters.
-- Both cases will also result in adding 'urlversion=2' to
the end result URL.
- Accessing Special:RecentChanges?urlversion=2 (without any other
parameters) will result in loading a completely empty filter set
in RCFilters. We assume that 'urlversion=2' does not load defaults
even if it is the only parameter in the URL.
- Accessing Special:RecentChanges?hideX=1 (parameter set without
urlversion=2) will result in the front end taking the requested
parameters, merging them with user/wiki default (reproducing what
the backend does) and then adding urlversion=2 to the URL.
In all cases except for the default-saved-query-load case, the initial
load will **not** re-request data from the backend. The backend needs
to adjust to respect urlversion=2 as well (will come in an upcoming
commit) so the state and expectation of both the front- and back-end
are the same.
This commit also factors out URL handing to a separate class (UriProcessor)
and adds unit tests for it.
Bug: T166907
Bug: T166972
Bug: T166974
Change-Id: I0eed3bc0d4fa4810b6301b535c75b6bfbc8b4a5b
In 1bf5a652 the id selector was changed to a class selector for toctitle.
The cached HTML has been expired now and the id selector is not necessary
anymore.
Also remove the id selector #toc.tochidden for print style. This is not
necessary because the tochidden gets only added to .toc and not to #toc.
Change-Id: I43cfffdb0807e8ed8f6b7b8732ba857b709bee80
In order to minimize the URL query, we use a base representation of the
parameters as if they were all '0' or '' and internally expand on it.
- Only display parameters with a value that is not empty or '0' in the
URI. Any parameter that is missing from the URI is presumed to have
an empty value.
- Stop pushing defaultParameters everywhere. Default parameters should
only be considered either on load (when/if needed) or when the user
actively requests for them.
- Minimize parameters to the URL, and expand when reading into the model.
Similar to using base filters, we can use a representation of base
parameters to make the URL small but the representation all-encompassing.
Bug: T165445
Change-Id: I1d21c38137fde51fcd561e2de24592722bf532c6
Before 2d95d36a8e, clicks on links inside toggles with non-empty
targets that are not '#', were ignored ("pass through") since they
are not intended for the toggle.
In 2d95d36a8e, this was simplified to ignoring clicks from all <a>
elements inside toggles. However this ignored too much as links
without 'href' attribute are also sometimes used inside toggles
to look like links and have no href-target, which means clicking
them does nothing and is in fact meant to toggle the element.
Restore previous behaviour and restore previous test + add a new
test for this specific case.
Bug: T166298
Change-Id: Ia3a0648f809f94be0977a83b469fbd184aa72aff
The naming convention remains unchainched. Default toggles are added if no mw-collapsible-toggle child element is present. Premade toggles have already one ore more mw-collapsible-toggle elements defined.
Default and premade toggles (mw-collapsible-toggle) still cannot be mixed/combined with remote toggles (mw-customtoggle).
* The default toggle got less rigid by removing dependency on <a> elements.
* Support for multiple premade toggles was introduced.
* The expand/collapse messages can be used by premade toggles via mw-collapsible-text.
* Removed the linksPassthru option. This step allowed merging premadeToggleHandler into actionHandler.
* The pass through functionality is now applied to all <a> elements since the default toggle does no longer depends on those.
* Removed mw-collapsible-bracket because it was not used and is deprecated by mw-collapsible-text.
* The test suite was adapted to reflect the latest changes.
Change-Id: Ic8627c4c185e8e4175e6fef1c8e1c2190e54edaa
Because '0' is a string, it's true, but for our purposes, it's
supposed to be false. Thanks JavaScript.
This bug was actually pretty horrific, it meant that when you refresh
the representation is all wrong (all items in the group were considered
true if the group was 'send_unselected_if_any' which meant that most
of those (that are full coverage) 'corrected themselves' to be all-false
which meant you lost filters when refreshing, even though the parameters
appeared in the URL (the url helpfully corrects itself based on the model
but the model was wrong.)
How did this pass unit tests, one might ask. Well, the unit tests were
treating parameter values as numbers, rather than strings, a fact that
is promptly fixed in this commit.
Also, for consistency and proper data validation, all parameters are
now always stored and handled as strings, in the model.
Bug: T165230
Change-Id: I16d8d95be067b3e48e557ef25f8eb6a49736aa4e
Make the view model more generic and ready to accept other types
of filtering, like namespaces and tags, by handing off the responsibility
and logic of the parameterizing and filter relationships to the groups.
Change-Id: I9c333719e89088d96d044d72ddb9c39feeeb68ca
Up until now we assumed that this method should output the parameters
from the state of the system, which meant that even if it accepted an
external list, it required that it be the format of this.groups.
Instead, allow the method to accept a "flat" list of filter name/values
and translate that to a parameter state without changing the model state.
Change-Id: Ib41da620a16d874326fe73220ae7a0114c555639
Stopping the animation is essentially the same as pausing, it remains in the
animation registry and will continue to fail all subsequent tests until one
of those later tests starts the animation queue again and also happens to
wait long enough for this unrelated animation to finish.
Fix the testrunner to actually fully stop the pre-existing animations, which
requires clearing $.timers as well. This matches the logic we have for
pending ajax requests.
Bug: T163211
Change-Id: Ic7d848187bc3c800e8347e0650093b2ffce6dddc
Since 1bf5a652 multiple TOCs are supported.
In CSS the selector #toc is kept for backward compatibility for uses in the
content.
Change-Id: I07036c0d5782420fc127781a15c675fc7e6fafaf
* Move `restoreWarnings()` in tearDown() to the mirrored location
of related code in setUp().
* Ensure that accidentally calling `suppressWarnings()` twice will
not wipe out the original reference indefinitely. If it was
already set, subsequent calls should do nothing instead of
overwriting them again so that recovery is still possible.
* Log all ajax requests logged during the test, not just the
one currently still pending. This should avoid situations
where we throw "Pending ajax requests" but no information
is logged about which requests those might be.
Change-Id: I900ad98c4c8520bdd6ae00a24ac82272f3becfee
It's not very useful and needlessly emits deprecation warnings
which unfortunately cannot be surpressed at runtime.
The test just asserts that a no-op function exists.
Change-Id: I2768ba40191a3c0cc7be6202ffa5bed529eabfee