Commit Graph

94 Commits

Author SHA1 Message Date
Vincent Petry f2de58db8c
Work around snap.js state mess
Snap.js is not robust enough to prevent multiple calls to open() or
close(), so we added more checks to prevent these happening even when an
animation is in progress.

Because if we let this through, snap.js will not notice that the
animation is already done (or a duplicate animation was started),
so the "transitionend" event will not fire a second time.

During an animation, snap.js sets up a setInterval() that hogs the CPU
during the animation. Since a transition doesn't always end due to the
above conditions, that CPU hogging would stay forever.

This is the best workaround so far, it seems it's not possible to cancel
that interval from the outside nor to trigger events to make it do so.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2020-11-02 17:31:18 +01:00
npmbuildbot[bot] 34100f1775
Compile assets
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2020-10-28 10:28:19 +01:00
Christoph Wurst eaf4724acc
Move humanFileSize and OC.getCanonicalLocale to npm packages
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-05 08:48:49 +02:00
Christoph Wurst 8119e0b18e
Inline usages of OCP.Toast in bundled files
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-06 17:19:57 +02:00
Christoph Wurst a27a4f757d
Use @nextcloud/paths and deprecate OC helpers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-10-05 23:44:20 +02:00
Roeland Jago Douma 32587d7007
Remove the tests since the library is tested
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-10-04 19:32:12 +02:00
Daniel Calviño Sánchez abd5d10253 Add unit tests for "OC.Notification.hide()"
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-07-26 18:46:59 +02:00
Daniel Calviño Sánchez 03f2e8a10e Fix default timeouts in OC.Notification
When no timeout was given "show()" used the default timeout of
"OCP.Toast", which is 7 seconds instead of indefinitely as stated in the
documentation of "show()". "showHtml()" should also indefinitely show
the notification if no timeout is given, but due to the strict
comparison the notification was indefinitely shown only when a timeout
of 0 was explicitly given. Now both methods show the notification
indefinitely (or until it is explicitly hidden) when no timeout is
given.

The unit tests did not catch this error because "showHtml()" had no
tests (as before the move to Toastify it was called from "show()" and
thus implicitly tested), and because "show()" verified that "hide()" was
not called after some time; "hide()" is no longer called from "show()"
since "OCP.Toast" is used internally, so the test always passed even if
the notification was indeed hidden. Now the test is based on whether the
element is found or not, and explicit tests were added too for
"showHtml()".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-07-26 18:46:59 +02:00
Daniel Calviño Sánchez 14006b548e Fix mixed test for "show" and "showTemporary"
"showTemporary()" when a timeout was given was being tested along with
the "show()" tests; now there are two separate tests when a timeout is
given, one for "showTemporary()" and one for "show()".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-07-26 18:46:58 +02:00
Daniel Calviño Sánchez 2b1c80ea3f Check number of elements instead of if the jQuery object is defined
Tje jQuery object created through "$('#testArea .toastify')" will be
always defined even if no elements were found, so the check does not
really work; instead, it should be checked the number of elements found.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-07-26 18:46:51 +02:00
Daniel Calviño Sánchez 916c95758f
Rename parameter in OCP.Toast for consistency with OC.Notification
This fixes HTML messages in "OC.Notification.showTemporary" (as
"showHtml" was not set based on "isHTML"), and also makes OCP.Toast to
keep the old OC.Notification API when used directly.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2019-07-12 16:15:05 +02:00
Julius Härtl 6d848b545d
Adjust jsunit tests for new toast library
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2019-06-07 07:32:48 +02:00
Christoph Wurst a5ec4a9af4
Move l10n functions to the bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-05-13 18:42:49 +02:00
Christoph Wurst 51d49c3134
Move initCore to the bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-05-10 13:47:21 +02:00
Christoph Wurst e7a190179f
Change oc_config usage to OC.config
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-05-02 08:46:43 +02:00
Julius Härtl a696c011c2
Fix app menu calculation for random size of the right header
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-11-02 19:57:06 +01:00
Claas Augner d5e142a336
OC.getCanonicalLocale: fix tests
Signed-off-by: Claas Augner <git@caugner.de>
2018-10-24 11:17:58 +02:00
Claas Augner 00b8be60f2
humanFileSize: use toLocaleString
humanFileSize: add test with locale
humanFileSize: use canonical locale
humanFileSize: skip test w/o toLocaleString support
humanFileSize: stub getCanonicalLocale
OC.getCanonicalLocale: cover undefined case
humanFileSize: fix getCanonicalLocale stub

Signed-off-by: Claas Augner <git@caugner.de>
2018-10-24 09:18:39 +02:00
Christoph Wurst 9af69ca2a5
Fix usage of deprecated OC.webroot
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2018-10-09 13:53:59 +02:00
Christoph Wurst b9720703e8 Add CSRF token controller to retrieve the current CSRF token
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2018-03-08 16:48:50 +01:00
Daniel Calviño Sánchez 9c22e99331 Add extra test cases for password confirmation
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2018-01-10 16:42:25 +01:00
Abijeet b246ca96ff Added test cases for the fix for the password confirmation box appearing repeatedly.
Signed-off-by: Abijeet <abijeetpatro@gmail.com>
2018-01-10 16:41:27 +01:00
Daniel Calviño Sánchez de4028336a Force the drag to end when the navigation bar Snap is disabled by an app
When a Snap was disabled it stopped listening to the events, but if a
drag gesture was being performed it was kept as active. Thus, when the
Snap was enabled again move events were handled as if the Snap had never
been disabled, causing the gesture handling to continue where it was
left.

When the Snap for the navigation bar is disabled by an app it could be
as a result of a different gesture being recognized by the app (for
example, a vertical swipe) once both gestures have started. In that case
when the other gesture ends and the Snap is enabled again any pointer
movement will cause the navigation bar to slide until an "up" event is
triggered again (obviously not the desired behaviour).

Due to all this now when the Snap for the navigation bar is disabled by
an app the current drag gesture for the navigation bar is ended.

Note that this was added as a parameter to "Snap.disable()" instead of
done unconditionally to keep back-compatibility with the previous
behaviour (probably not really needed as it is unlikely that any app is
using the Snap library relying on that behaviour... but just in case).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-14 21:42:39 +01:00
Daniel Calviño Sánchez a5db0d2825 Make possible for apps to disallow the navigation bar slide gesture
On narrow screens a slide gesture can be used to open or close the
navigation bar. However that gesture could conflict at times with the
gestures used by certain apps (for example, if the right sidebar is open
the user may expect to close it by dragging it to the right, but that
could open the navigation bar instead depending on how the events are
handled). This commit makes possible for apps to disallow and allow
again that slide gesture.

In any case, note that applications can only disallow the gesture,
but they can not enable it. That is, they can prevent the gesture from
being used on narrow screens, but they can not make the gesture work on
wide screens; they are always limited by the base rules set by the core.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-14 21:41:22 +01:00
Daniel Calviño Sánchez 173f28a09d Add unit tests for the navigation bar slide gesture
The slide gesture is enabled or disabled depending on the width of the
browser window. In order to easily control that width the karma-viewport
plugin is now used in the unit tests.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-12-14 19:17:40 +01:00
Morris Jobke d790c27a19
Reduce JSHint errors/warnings
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 09:57:59 +01:00
Morris Jobke 413d671d9e Merge pull request #3635 from individual-it/fix_quota_validation
better quota validation
2017-02-28 00:27:51 -06:00
Artur Neumann 9790fe7f5d make values with white spaces possible
a user might enter values with white spaces, and that should be possible
and valid

Signed-off-by: Artur Neumann <info@individual-it.net>
2017-02-28 08:25:34 +05:45
Artur Neumann f1fccaca06 better quota validation
this fixes #3634

1. fixed computerFileSize to be more picky about incorrect values
2. more tests for computerFileSize
3. use computerFileSize to validate user quota

Signed-off-by: Artur Neumann <info@individual-it.net>
2017-02-28 07:38:11 +05:45
m3ntalsp00n dd9ee2db6f fix tests, longer wait time, update notification stub
Signed-off-by: m3ntalsp00n <m3ntalsp00n@gmail.com>
2017-02-04 18:51:52 +10:00
Christoph Wurst da28a1612e expect warning to be shown
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2017-01-13 11:33:12 +01:00
Patrick Paysant d4c088cb79
Verify input, add more unit tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-19 17:29:20 +01:00
Patrick Paysant ec4bca619d
Add test for unparseable string
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-19 17:29:13 +01:00
Patrick Paysant ff018d48cf
Implements all comments from @PVince81
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-19 17:29:05 +01:00
Patrick Paysant 6217393d6a
Adding computerFileSize in OC.Util
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-19 17:28:58 +01:00
Robin Appelman e055fbd4da
adjust js tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-12-02 13:40:23 +01:00
Vincent Petry 25d9dce067
JS utility function to compare paths
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-24 21:45:00 +02:00
Christoph Wurst 5ae6d62811
do not reload the page if the server is (temporarily) unreachable 2016-10-03 10:24:47 +02:00
Hendrik Leppelsack 61e604c2d9 adjusts tests to removal of svg fallback 2016-07-01 16:36:37 +02:00
Lukas Reschke 2c4ef37025 Merge pull request #24126 from owncloud/err-reload-delay
Delay reloading the page if an ajax error occurs, show notification
2016-04-22 11:23:39 +02:00
Robin McCorkell 62024d74d4 Add test for reload delay 2016-04-20 22:09:59 +01:00
Morris Jobke 6b66f2dfb4 Merge pull request #23990 from owncloud/heartbeat-debounce
Debounce heartbeat ajax calls to lower the number of requests
2016-04-20 21:23:10 +02:00
Christoph Wurst 2d772eaaa8
Debounce heartbeat ajax calls to lower the number of requests
fixes #22397
2016-04-18 14:19:26 +02:00
Christoph Wurst 5900e46f01
Turn off jQuery animations when testing 2016-04-18 10:41:02 +02:00
Christoph Wurst 3e1f1ccc76 downgrade jquery, update jquery-migrate 2016-04-15 13:55:23 +02:00
Vincent Petry 06e7856400 Adjust core unit tests for unload/reload cases 2016-03-23 10:53:40 +01:00
Vincent Petry 8ea80e114a Accumulate notifications instead of blinking
This makes it possible to display multiple notifications.
If the options.type is set to "error", it will also add a close button.
2016-02-22 17:25:32 +01:00
Vincent Petry b8b77709c0 Add handler for global ajax errors 2016-02-15 12:48:47 +01:00
Morris Jobke 6e096936e5 update JS humanFileSize to use KB instead of kB 2016-01-19 10:51:57 +01:00
Joas Schilling f04151f69b Close the user menu when clicking it again 2015-11-02 10:09:13 +01:00