Update jQuery to 3.7 and fix admintests (#5868)

* jQuery: Migrate to `.on()`, `.off()`, `.trigger()`

This avoids methods that are deprecated in newer versions of jQuery.

* jQuery: avoid `.removeAttr`, prefer `.prop`

* helper.edit: wait up to 10 seconds for ACCEPT_COMMIT

* Chat: disabled attribute is boolean

* Chat: avoid inline onclick handler to support jQuery 3.4+

* jQuery: update to version 3.6.0

* Update to 3.7

* Removed deprecated event.

* Revert change to focus on padeditor.ace

---------

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
This commit is contained in:
SamTV12345 2023-08-08 18:26:25 +02:00 committed by GitHub
parent 2f5b6b80e1
commit a096f1ae33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 9457 additions and 8785 deletions

View file

@ -37,7 +37,7 @@ helper.edit = async (message, line) => {
await helper.withFastCommit(async (incorp) => {
helper.linesDiv()[line].sendkeys(message);
incorp();
await helper.waitForPromise(() => editsNum + 1 === helper.commits.length);
await helper.waitForPromise(() => editsNum + 1 === helper.commits.length, 10000);
});
};
@ -94,7 +94,7 @@ helper.sendChatMessage = async (message) => {
*/
helper.showSettings = async () => {
if (helper.isSettingsShown()) return;
helper.settingsButton().click();
helper.settingsButton().trigger('click');
await helper.waitForPromise(() => helper.isSettingsShown(), 2000);
};
@ -106,7 +106,7 @@ helper.showSettings = async () => {
*/
helper.hideSettings = async () => {
if (!helper.isSettingsShown()) return;
helper.settingsButton().click();
helper.settingsButton().trigger('click');
await helper.waitForPromise(() => !helper.isSettingsShown(), 2000);
};
@ -119,7 +119,7 @@ helper.hideSettings = async () => {
helper.enableStickyChatviaSettings = async () => {
const stickyChat = helper.padChrome$('#options-stickychat');
if (!helper.isSettingsShown() || stickyChat.is(':checked')) return;
stickyChat.click();
stickyChat.trigger('click');
await helper.waitForPromise(() => helper.isChatboxSticky(), 2000);
};
@ -132,7 +132,7 @@ helper.enableStickyChatviaSettings = async () => {
helper.disableStickyChatviaSettings = async () => {
const stickyChat = helper.padChrome$('#options-stickychat');
if (!helper.isSettingsShown() || !stickyChat.is(':checked')) return;
stickyChat.click();
stickyChat.trigger('click');
await helper.waitForPromise(() => !helper.isChatboxSticky(), 2000);
};
@ -145,7 +145,7 @@ helper.disableStickyChatviaSettings = async () => {
helper.enableStickyChatviaIcon = async () => {
const stickyChat = helper.padChrome$('#titlesticky');
if (!helper.isChatboxShown() || helper.isChatboxSticky()) return;
stickyChat.click();
stickyChat.trigger('click');
await helper.waitForPromise(() => helper.isChatboxSticky(), 2000);
};
@ -157,7 +157,7 @@ helper.enableStickyChatviaIcon = async () => {
*/
helper.disableStickyChatviaIcon = async () => {
if (!helper.isChatboxShown() || !helper.isChatboxSticky()) return;
helper.titlecross().click();
helper.titlecross().trigger('click');
await helper.waitForPromise(() => !helper.isChatboxSticky(), 2000);
};

View file

@ -16,7 +16,7 @@ helper.contentWindow = () => $('#iframe-container iframe')[0].contentWindow;
helper.showChat = async () => {
const chaticon = helper.chatIcon();
if (!chaticon.hasClass('visible')) return;
chaticon.click();
chaticon.trigger('click');
await helper.waitForPromise(() => !chaticon.hasClass('visible'), 2000);
};
@ -27,7 +27,7 @@ helper.showChat = async () => {
*/
helper.hideChat = async () => {
if (!helper.isChatboxShown() || helper.isChatboxSticky()) return;
helper.titlecross().click();
helper.titlecross().trigger('click');
await helper.waitForPromise(() => !helper.isChatboxShown(), 2000);
};
@ -80,7 +80,7 @@ helper.settingsButton =
helper.toggleUserList = async () => {
const isVisible = helper.userListShown();
const button = helper.padChrome$("button[data-l10n-id='pad.toolbar.showusers.title']");
button.click();
button.trigger('click');
await helper.waitForPromise(() => !isVisible);
};
@ -104,9 +104,9 @@ helper.userListShown = () => helper.padChrome$('div#users').hasClass('popup-show
*/
helper.setUserName = async (name) => {
const userElement = helper.usernameField();
userElement.click();
userElement.trigger('click');
userElement.val(name);
userElement.blur();
userElement.trigger('blur');
await helper.waitForPromise(() => !helper.usernameField().hasClass('editactive'));
};