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

@ -2585,17 +2585,17 @@ function Ace2Inner(editorInfo, cssManagers) {
const firstEditbarElement = parent.parent.$('#editbar') const firstEditbarElement = parent.parent.$('#editbar')
.children('ul').first().children().first() .children('ul').first().children().first()
.children().first().children().first(); .children().first().children().first();
$(this).blur(); $(this).trigger('blur');
firstEditbarElement.focus(); firstEditbarElement.trigger('focus');
evt.preventDefault(); evt.preventDefault();
} }
if (!specialHandled && type === 'keydown' && if (!specialHandled && type === 'keydown' &&
altKey && keyCode === 67 && altKey && keyCode === 67 &&
padShortcutEnabled.altC) { padShortcutEnabled.altC) {
// Alt c focuses on the Chat window // Alt c focuses on the Chat window
$(this).blur(); $(this).trigger('blur');
parent.parent.chat.show(); parent.parent.chat.show();
parent.parent.$('#chatinput').focus(); parent.parent.$('#chatinput').trigger('focus');
evt.preventDefault(); evt.preventDefault();
} }
if (!specialHandled && type === 'keydown' && if (!specialHandled && type === 'keydown' &&

View file

@ -164,7 +164,7 @@
$(window).resize(adjust); $(window).resize(adjust);
// Allow for manual triggering if needed. // Allow for manual triggering if needed.
$ta.bind('autosize', adjust); $ta.on('autosize', adjust);
// Call adjust in case the textarea already contains text. // Call adjust in case the textarea already contains text.
adjust(); adjust();

View file

@ -112,15 +112,15 @@ $(document).ready(() => {
const updateHandlers = () => { const updateHandlers = () => {
// Search // Search
$('#search-query').unbind('keyup').keyup(() => { $('#search-query').off('keyup').on('keyup', () => {
search($('#search-query').val()); search($('#search-query').val());
}); });
// Prevent form submit // Prevent form submit
$('#search-query').parent().bind('submit', () => false); $('#search-query').parent().on('submit', () => false);
// update & install // update & install
$('.do-install, .do-update').unbind('click').click(function (e) { $('.do-install, .do-update').off('click').on('click', function (e) {
const $row = $(e.target).closest('tr'); const $row = $(e.target).closest('tr');
const plugin = $row.data('plugin'); const plugin = $row.data('plugin');
if ($(this).hasClass('do-install')) { if ($(this).hasClass('do-install')) {
@ -134,7 +134,7 @@ $(document).ready(() => {
}); });
// uninstall // uninstall
$('.do-uninstall').unbind('click').click((e) => { $('.do-uninstall').off('click').on('click', (e) => {
const $row = $(e.target).closest('tr'); const $row = $(e.target).closest('tr');
const pluginName = $row.data('plugin'); const pluginName = $row.data('plugin');
socket.emit('uninstall', pluginName); socket.emit('uninstall', pluginName);
@ -143,14 +143,14 @@ $(document).ready(() => {
}); });
// Sort // Sort
$('.sort.up').unbind('click').click(function () { $('.sort.up').off('click').on('click', function () {
search.sortBy = $(this).attr('data-label').toLowerCase(); search.sortBy = $(this).attr('data-label').toLowerCase();
search.sortDir = false; search.sortDir = false;
search.offset = 0; search.offset = 0;
search(search.searchTerm, search.results.length); search(search.searchTerm, search.results.length);
search.results = []; search.results = [];
}); });
$('.sort.down, .sort.none').unbind('click').click(function () { $('.sort.down, .sort.none').off('click').on('click', function () {
search.sortBy = $(this).attr('data-label').toLowerCase(); search.sortBy = $(this).attr('data-label').toLowerCase();
search.sortDir = true; search.sortDir = true;
search.offset = 0; search.offset = 0;
@ -164,7 +164,7 @@ $(document).ready(() => {
if (data.query.offset === 0) search.results = []; if (data.query.offset === 0) search.results = [];
search.messages.hide('nothing-found'); search.messages.hide('nothing-found');
search.messages.hide('fetching'); search.messages.hide('fetching');
$('#search-query').removeAttr('disabled'); $('#search-query').prop('disabled', false);
console.log('got search results', data); console.log('got search results', data);

View file

@ -25,7 +25,7 @@ $(document).ready(() => {
/* Check to make sure the JSON is clean before proceeding */ /* Check to make sure the JSON is clean before proceeding */
if (isJSONClean(settings.results)) { if (isJSONClean(settings.results)) {
$('.settings').append(settings.results); $('.settings').append(settings.results);
$('.settings').focus(); $('.settings').trigger('focus');
$('.settings').autosize(); $('.settings').autosize();
} else { } else {
alert('Invalid JSON'); alert('Invalid JSON');
@ -40,7 +40,7 @@ $(document).ready(() => {
socket.emit('saveSettings', $('.settings').val()); socket.emit('saveSettings', $('.settings').val());
} else { } else {
alert('Invalid JSON'); alert('Invalid JSON');
$('.settings').focus(); $('.settings').trigger('focus');
} }
}); });
@ -62,7 +62,7 @@ const isJSONClean = (data) => {
// this is a bit naive. In theory some key/value might contain the sequences ',]' or ',}' // this is a bit naive. In theory some key/value might contain the sequences ',]' or ',}'
cleanSettings = cleanSettings.replace(',]', ']').replace(',}', '}'); cleanSettings = cleanSettings.replace(',]', ']').replace(',}', '}');
try { try {
return typeof jQuery.parseJSON(cleanSettings) === 'object'; return typeof JSON.parseJSON(cleanSettings) === 'object';
} catch (e) { } catch (e) {
return false; // the JSON failed to be parsed return false; // the JSON failed to be parsed
} }

View file

@ -67,7 +67,7 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => {
newSavedRevision.css( newSavedRevision.css(
'left', (position * ($('#ui-slider-bar').width() - 2) / (sliderLength * 1.0)) - 1); 'left', (position * ($('#ui-slider-bar').width() - 2) / (sliderLength * 1.0)) - 1);
$('#ui-slider-bar').append(newSavedRevision); $('#ui-slider-bar').append(newSavedRevision);
newSavedRevision.mouseup((evt) => { newSavedRevision.on('mouseup', (evt) => {
BroadcastSlider.setSliderPosition(position); BroadcastSlider.setSliderPosition(position);
}); });
savedRevisions.push(newSavedRevision); savedRevisions.push(newSavedRevision);
@ -209,21 +209,21 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => {
// assign event handlers to html UI elements after page load // assign event handlers to html UI elements after page load
fireWhenAllScriptsAreLoaded.push(() => { fireWhenAllScriptsAreLoaded.push(() => {
$(document).keyup((e) => { $(document).on('keyup', (e) => {
if (!e) e = window.event; if (!e) e = window.event;
const code = e.keyCode || e.which; const code = e.keyCode || e.which;
if (code === 37) { // left if (code === 37) { // left
if (e.shiftKey) { if (e.shiftKey) {
$('#leftstar').click(); $('#leftstar').trigger('click');
} else { } else {
$('#leftstep').click(); $('#leftstep').trigger('click');
} }
} else if (code === 39) { // right } else if (code === 39) { // right
if (e.shiftKey) { if (e.shiftKey) {
$('#rightstar').click(); $('#rightstar').trigger('click');
} else { } else {
$('#rightstep').click(); $('#rightstep').trigger('click');
} }
} else if (code === 32) { // spacebar } else if (code === 32) { // spacebar
$('#playpause_button_icon').trigger('click'); $('#playpause_button_icon').trigger('click');
@ -231,22 +231,22 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => {
}); });
// Resize // Resize
$(window).resize(() => { $(window).on('resize', () => {
updateSliderElements(); updateSliderElements();
}); });
// Slider click // Slider click
$('#ui-slider-bar').mousedown((evt) => { $('#ui-slider-bar').on('mousedown', (evt) => {
$('#ui-slider-handle').css('left', (evt.clientX - $('#ui-slider-bar').offset().left)); $('#ui-slider-handle').css('left', (evt.clientX - $('#ui-slider-bar').offset().left));
$('#ui-slider-handle').trigger(evt); $('#ui-slider-handle').trigger(evt);
}); });
// Slider dragging // Slider dragging
$('#ui-slider-handle').mousedown(function (evt) { $('#ui-slider-handle').on('mousedown', function (evt) {
this.startLoc = evt.clientX; this.startLoc = evt.clientX;
this.currentLoc = parseInt($(this).css('left')); this.currentLoc = parseInt($(this).css('left'));
sliderActive = true; sliderActive = true;
$(document).mousemove((evt2) => { $(document).on('mousemove', (evt2) => {
$(this).css('pointer', 'move'); $(this).css('pointer', 'move');
let newloc = this.currentLoc + (evt2.clientX - this.startLoc); let newloc = this.currentLoc + (evt2.clientX - this.startLoc);
if (newloc < 0) newloc = 0; if (newloc < 0) newloc = 0;
@ -257,9 +257,9 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => {
$(this).css('left', newloc); $(this).css('left', newloc);
if (getSliderPosition() !== version) _callSliderCallbacks(version); if (getSliderPosition() !== version) _callSliderCallbacks(version);
}); });
$(document).mouseup((evt2) => { $(document).on('mouseup', (evt2) => {
$(document).unbind('mousemove'); $(document).off('mousemove');
$(document).unbind('mouseup'); $(document).off('mouseup');
sliderActive = false; sliderActive = false;
let newloc = this.currentLoc + (evt2.clientX - this.startLoc); let newloc = this.currentLoc + (evt2.clientX - this.startLoc);
if (newloc < 0) newloc = 0; if (newloc < 0) newloc = 0;
@ -276,12 +276,12 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => {
}); });
// play/pause toggling // play/pause toggling
$('#playpause_button_icon').click((evt) => { $('#playpause_button_icon').on('click', (evt) => {
BroadcastSlider.playpause(); BroadcastSlider.playpause();
}); });
// next/prev saved revision and changeset // next/prev saved revision and changeset
$('.stepper').click(function (evt) { $('.stepper').on('click', function (evt) {
switch ($(this).attr('id')) { switch ($(this).attr('id')) {
case 'leftstep': case 'leftstep':
setSliderPosition(getSliderPosition() - 1); setSliderPosition(getSliderPosition() - 1);

View file

@ -42,11 +42,14 @@ exports.chat = (() => {
}, },
focus: () => { focus: () => {
setTimeout(() => { setTimeout(() => {
$('#chatinput').focus(); $('#chatinput').trigger('focus');
}, 100); }, 100);
}, },
// Make chat stick to right hand side of screen // Make chat stick to right hand side of screen
stickToScreen(fromInitialCall) { stickToScreen(fromInitialCall) {
if ($('#options-stickychat').prop('checked')) {
$('#options-stickychat').prop('checked', false);
}
if (pad.settings.hideChat) { if (pad.settings.hideChat) {
return; return;
} }
@ -68,7 +71,7 @@ exports.chat = (() => {
this.stickToScreen(true); this.stickToScreen(true);
$('#options-stickychat').prop('checked', true); $('#options-stickychat').prop('checked', true);
$('#options-chatandusers').prop('checked', true); $('#options-chatandusers').prop('checked', true);
$('#options-stickychat').prop('disabled', 'disabled'); $('#options-stickychat').prop('disabled', true);
userAndChat = true; userAndChat = true;
} else { } else {
$('#options-stickychat').prop('disabled', false); $('#options-stickychat').prop('disabled', false);
@ -223,14 +226,14 @@ exports.chat = (() => {
// Send the users focus back to the pad // Send the users focus back to the pad
if ((evt.altKey === true && evt.which === 67) || evt.which === 27) { if ((evt.altKey === true && evt.which === 67) || evt.which === 27) {
// If we're in chat already.. // If we're in chat already..
$(':focus').blur(); // required to do not try to remove! $(':focus').trigger('blur'); // required to do not try to remove!
padeditor.ace.focus(); // Sends focus back to pad padeditor.ace.focus(); // Sends focus back to pad
evt.preventDefault(); evt.preventDefault();
return false; return false;
} }
}); });
// Clear the chat mentions when the user clicks on the chat input box // Clear the chat mentions when the user clicks on the chat input box
$('#chatinput').click(() => { $('#chatinput').on('click', () => {
chatMentions = 0; chatMentions = 0;
Tinycon.setBubble(0); Tinycon.setBubble(0);
}); });
@ -239,14 +242,14 @@ exports.chat = (() => {
$('body:not(#chatinput)').on('keypress', function (evt) { $('body:not(#chatinput)').on('keypress', function (evt) {
if (evt.altKey && evt.which === 67) { if (evt.altKey && evt.which === 67) {
// Alt c focuses on the Chat window // Alt c focuses on the Chat window
$(this).blur(); $(this).trigger('blur');
self.show(); self.show();
$('#chatinput').focus(); $('#chatinput').trigger('focus');
evt.preventDefault(); evt.preventDefault();
} }
}); });
$('#chatinput').keypress((evt) => { $('#chatinput').on('keypress', (evt) => {
// if the user typed enter, fire the send // if the user typed enter, fire the send
if (evt.key === 'Enter' && !evt.shiftKey) { if (evt.key === 'Enter' && !evt.shiftKey) {
evt.preventDefault(); evt.preventDefault();
@ -257,7 +260,7 @@ exports.chat = (() => {
// initial messages are loaded in pad.js' _afterHandshake // initial messages are loaded in pad.js' _afterHandshake
$('#chatcounter').text(0); $('#chatcounter').text(0);
$('#chatloadmessagesbutton').click(() => { $('#chatloadmessagesbutton').on('click', () => {
const start = Math.max(this.historyPointer - 20, 0); const start = Math.max(this.historyPointer - 20, 0);
const end = this.historyPointer; const end = this.historyPointer;

View file

@ -66,7 +66,7 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad)
if (browser.firefox) { if (browser.firefox) {
// Prevent "escape" from taking effect and canceling a comet connection; // Prevent "escape" from taking effect and canceling a comet connection;
// doesn't work if focus is on an iframe. // doesn't work if focus is on an iframe.
$(window).bind('keydown', (evt) => { $(window).on('keydown', (evt) => {
if (evt.which === 27) { if (evt.which === 27) {
evt.preventDefault(); evt.preventDefault();
} }

View file

@ -41,7 +41,7 @@ const randomPadName = () => {
}; };
$(() => { $(() => {
$('#go2Name').submit(() => { $('#go2Name').on('submit', () => {
const padname = $('#padname').val(); const padname = $('#padname').val();
if (padname.length > 0) { if (padname.length > 0) {
window.location = `p/${encodeURIComponent(padname.trim())}`; window.location = `p/${encodeURIComponent(padname.trim())}`;
@ -51,7 +51,7 @@ $(() => {
return false; return false;
}); });
$('#button').click(() => { $('#button').on('click', () => {
window.location = `p/${randomPadName()}`; window.location = `p/${randomPadName()}`;
}); });

View file

@ -412,10 +412,12 @@ const pad = {
setTimeout(() => { setTimeout(() => {
padeditor.ace.focus(); padeditor.ace.focus();
}, 0); }, 0);
const optionsStickyChat = $('#options-stickychat');
optionsStickyChat.on('click', () => { chat.stickToScreen(); });
// if we have a cookie for always showing chat then show it // if we have a cookie for always showing chat then show it
if (padcookie.getPref('chatAlwaysVisible')) { if (padcookie.getPref('chatAlwaysVisible')) {
chat.stickToScreen(true); // stick it to the screen chat.stickToScreen(true); // stick it to the screen
$('#options-stickychat').prop('checked', true); // set the checkbox to on optionsStickyChat.prop('checked', true); // set the checkbox to on
} }
// if we have a cookie for always showing chat then show it // if we have a cookie for always showing chat then show it
if (padcookie.getPref('chatAndUsers')) { if (padcookie.getPref('chatAndUsers')) {
@ -437,8 +439,8 @@ const pad = {
// Prevent sticky chat or chat and users to be checked for mobiles // Prevent sticky chat or chat and users to be checked for mobiles
const checkChatAndUsersVisibility = (x) => { const checkChatAndUsersVisibility = (x) => {
if (x.matches) { // If media query matches if (x.matches) { // If media query matches
$('#options-chatandusers:checked').click(); $('#options-chatandusers:checked').trigger('click');
$('#options-stickychat:checked').click(); $('#options-stickychat:checked').trigger('click');
} }
}; };
const mobileMatch = window.matchMedia('(max-width: 800px)'); const mobileMatch = window.matchMedia('(max-width: 800px)');
@ -711,7 +713,7 @@ const pad = {
$('form#reconnectform input.diagnosticInfo').val(JSON.stringify(pad.diagnosticInfo)); $('form#reconnectform input.diagnosticInfo').val(JSON.stringify(pad.diagnosticInfo));
$('form#reconnectform input.missedChanges') $('form#reconnectform input.missedChanges')
.val(JSON.stringify(pad.collabClient.getMissedChanges())); .val(JSON.stringify(pad.collabClient.getMissedChanges()));
$('form#reconnectform').submit(); $('form#reconnectform').trigger('submit');
}, },
callWhenNotCommitting: (f) => { callWhenNotCommitting: (f) => {
pad.collabClient.callWhenNotCommitting(f); pad.collabClient.callWhenNotCommitting(f);

View file

@ -96,7 +96,7 @@ const whenConnectionIsRestablishedWithServer = (callback, pad) => {
}; };
const forceReconnection = ($modal) => { const forceReconnection = ($modal) => {
$modal.find('#forcereconnect').click(); $modal.find('#forcereconnect').trigger('click');
}; };
const updateCountDownTimerMessage = ($modal, minutes, seconds) => { const updateCountDownTimerMessage = ($modal, minutes, seconds) => {

View file

@ -31,7 +31,7 @@ const padconnectionstatus = (() => {
const self = { const self = {
init: () => { init: () => {
$('button#forcereconnect').click(() => { $('button#forcereconnect').on('click', () => {
window.location.reload(); window.location.reload();
}); });
}, },

View file

@ -65,13 +65,13 @@ class ToolbarItem {
bind(callback) { bind(callback) {
if (this.isButton()) { if (this.isButton()) {
this.$el.click((event) => { this.$el.on('click', (event) => {
$(':focus').blur(); $(':focus').trigger('blur');
callback(this.getCommand(), this); callback(this.getCommand(), this);
event.preventDefault(); event.preventDefault();
}); });
} else if (this.isSelect()) { } else if (this.isSelect()) {
this.$el.find('select').change(() => { this.$el.find('select').on('change', () => {
callback(this.getCommand(), this); callback(this.getCommand(), this);
}); });
} }
@ -134,7 +134,7 @@ exports.padeditbar = new class {
$('#editbar .editbarbutton').attr('unselectable', 'on'); // for IE $('#editbar .editbarbutton').attr('unselectable', 'on'); // for IE
this.enable(); this.enable();
$('#editbar [data-key]').each((i, elt) => { $('#editbar [data-key]').each((i, elt) => {
$(elt).unbind('click'); $(elt).off('click');
new ToolbarItem($(elt)).bind((command, item) => { new ToolbarItem($(elt)).bind((command, item) => {
this.triggerCommand(command, item); this.triggerCommand(command, item);
}); });
@ -144,11 +144,11 @@ exports.padeditbar = new class {
this._bodyKeyEvent(evt); this._bodyKeyEvent(evt);
}); });
$('.show-more-icon-btn').click(() => { $('.show-more-icon-btn').on('click', () => {
$('.toolbar').toggleClass('full-icons'); $('.toolbar').toggleClass('full-icons');
}); });
this.checkAllIconsAreDisplayedInToolbar(); this.checkAllIconsAreDisplayedInToolbar();
$(window).resize(_.debounce(() => this.checkAllIconsAreDisplayedInToolbar(), 100)); $(window).on('resize', _.debounce(() => this.checkAllIconsAreDisplayedInToolbar(), 100));
this._registerDefaultCommands(); this._registerDefaultCommands();
@ -168,7 +168,7 @@ exports.padeditbar = new class {
} }
// When editor is scrolled, we add a class to style the editbar differently // When editor is scrolled, we add a class to style the editbar differently
$('iframe[name="ace_outer"]').contents().scroll((ev) => { $('iframe[name="ace_outer"]').contents().on('scroll', (ev) => {
$('#editbar').toggleClass('editor-scrolled', $(ev.currentTarget).scrollTop() > 2); $('#editbar').toggleClass('editor-scrolled', $(ev.currentTarget).scrollTop() > 2);
}); });
} }
@ -305,12 +305,12 @@ exports.padeditbar = new class {
// Close any dropdowns we have open.. // Close any dropdowns we have open..
this.toggleDropDown('none'); this.toggleDropDown('none');
// Shift focus away from any drop downs // Shift focus away from any drop downs
$(':focus').blur(); // required to do not try to remove! $(':focus').trigger('blur'); // required to do not try to remove!
// Check we're on a pad and not on the timeslider // Check we're on a pad and not on the timeslider
// Or some other window I haven't thought about! // Or some other window I haven't thought about!
if (typeof pad === 'undefined') { if (typeof pad === 'undefined') {
// Timeslider probably.. // Timeslider probably..
$('#editorcontainerbox').focus(); // Focus back onto the pad $('#editorcontainerbox').trigger('focus'); // Focus back onto the pad
} else { } else {
padeditor.ace.focus(); // Sends focus back to pad padeditor.ace.focus(); // Sends focus back to pad
// The above focus doesn't always work in FF, you have to hit enter afterwards // The above focus doesn't always work in FF, you have to hit enter afterwards
@ -320,8 +320,8 @@ exports.padeditbar = new class {
// Focus on the editbar :) // Focus on the editbar :)
const firstEditbarElement = parent.parent.$('#editbar button').first(); const firstEditbarElement = parent.parent.$('#editbar button').first();
$(evt.currentTarget).blur(); $(evt.currentTarget).trigger('blur');
firstEditbarElement.focus(); firstEditbarElement.trigger('focus');
evt.preventDefault(); evt.preventDefault();
} }
} }
@ -341,7 +341,7 @@ exports.padeditbar = new class {
this._editbarPosition--; this._editbarPosition--;
// Allow focus to shift back to end of row and start of row // Allow focus to shift back to end of row and start of row
if (this._editbarPosition === -1) this._editbarPosition = focusItems.length - 1; if (this._editbarPosition === -1) this._editbarPosition = focusItems.length - 1;
$(focusItems[this._editbarPosition]).focus(); $(focusItems[this._editbarPosition]).trigger('focus');
} }
// On right arrow move to next button in editbar // On right arrow move to next button in editbar
@ -352,7 +352,7 @@ exports.padeditbar = new class {
this._editbarPosition++; this._editbarPosition++;
// Allow focus to shift back to end of row and start of row // Allow focus to shift back to end of row and start of row
if (this._editbarPosition >= focusItems.length) this._editbarPosition = 0; if (this._editbarPosition >= focusItems.length) this._editbarPosition = 0;
$(focusItems[this._editbarPosition]).focus(); $(focusItems[this._editbarPosition]).trigger('focus');
} }
} }
} }
@ -366,7 +366,7 @@ exports.padeditbar = new class {
this.registerCommand('settings', () => { this.registerCommand('settings', () => {
this.toggleDropDown('settings'); this.toggleDropDown('settings');
$('#options-stickychat').focus(); $('#options-stickychat').trigger('focus');
}); });
this.registerCommand('import_export', () => { this.registerCommand('import_export', () => {
@ -374,22 +374,22 @@ exports.padeditbar = new class {
// If Import file input exists then focus on it.. // If Import file input exists then focus on it..
if ($('#importfileinput').length !== 0) { if ($('#importfileinput').length !== 0) {
setTimeout(() => { setTimeout(() => {
$('#importfileinput').focus(); $('#importfileinput').trigger('focus');
}, 100); }, 100);
} else { } else {
$('.exportlink').first().focus(); $('.exportlink').first().trigger('focus');
} }
}); });
this.registerCommand('showusers', () => { this.registerCommand('showusers', () => {
this.toggleDropDown('users'); this.toggleDropDown('users');
$('#myusernameedit').focus(); $('#myusernameedit').trigger('focus');
}); });
this.registerCommand('embed', () => { this.registerCommand('embed', () => {
this.setEmbedLinks(); this.setEmbedLinks();
this.toggleDropDown('embed'); this.toggleDropDown('embed');
$('#linkinput').focus().select(); $('#linkinput').trigger('focus').trigger('select');
}); });
this.registerCommand('savedRevision', () => { this.registerCommand('savedRevision', () => {

View file

@ -76,7 +76,7 @@ const padeditor = (() => {
}); });
// font family change // font family change
$('#viewfontmenu').change(() => { $('#viewfontmenu').on('change', () => {
pad.changeViewOption('padFontFamily', $('#viewfontmenu').val()); pad.changeViewOption('padFontFamily', $('#viewfontmenu').val());
}); });
@ -97,7 +97,7 @@ const padeditor = (() => {
}); });
}); });
$('#languagemenu').val(html10n.getLanguage()); $('#languagemenu').val(html10n.getLanguage());
$('#languagemenu').change(() => { $('#languagemenu').on('change', () => {
Cookies.set('language', $('#languagemenu').val()); Cookies.set('language', $('#languagemenu').val());
window.html10n.localize([$('#languagemenu').val(), 'en']); window.html10n.localize([$('#languagemenu').val(), 'en']);
if ($('select').niceSelect) { if ($('select').niceSelect) {

View file

@ -38,7 +38,7 @@ const padimpexp = (() => {
const fileInputUpdated = () => { const fileInputUpdated = () => {
$('#importsubmitinput').addClass('throbbold'); $('#importsubmitinput').addClass('throbbold');
$('#importformfilediv').addClass('importformenabled'); $('#importformfilediv').addClass('importformenabled');
$('#importsubmitinput').removeAttr('disabled'); $('#importsubmitinput').prop('disabled', false);
$('#importmessagefail').fadeOut('fast'); $('#importmessagefail').fadeOut('fast');
}; };
@ -69,8 +69,8 @@ const padimpexp = (() => {
$('#import_export').removeClass('popup-show'); $('#import_export').removeClass('popup-show');
if (directDatabaseAccess) window.location.reload(); if (directDatabaseAccess) window.location.reload();
} }
$('#importsubmitinput').removeAttr('disabled').val(html10n.get('pad.impexp.importbutton')); $('#importsubmitinput').prop('disabled', false).val(html10n.get('pad.impexp.importbutton'));
window.setTimeout(() => $('#importfileinput').removeAttr('disabled'), 0); window.setTimeout(() => $('#importfileinput').prop('disabled', false), 0);
$('#importstatusball').hide(); $('#importstatusball').hide();
addImportFrames(); addImportFrames();
})(); })();
@ -162,9 +162,9 @@ const padimpexp = (() => {
} }
addImportFrames(); addImportFrames();
$('#importfileinput').change(fileInputUpdated); $('#importfileinput').on('change', fileInputUpdated);
$('#importform').unbind('submit').submit(fileInputSubmit); $('#importform').off('submit').on('submit', fileInputSubmit);
$('.disabledexport').click(cantExport); $('.disabledexport').on('click', cantExport);
}, },
disable: () => { disable: () => {
$('#impexp-disabled-clickcatcher').show(); $('#impexp-disabled-clickcatcher').show();

View file

@ -325,23 +325,23 @@ const paduserlist = (() => {
}; };
const setUpEditable = (jqueryNode, valueGetter, valueSetter) => { const setUpEditable = (jqueryNode, valueGetter, valueSetter) => {
jqueryNode.bind('focus', (evt) => { jqueryNode.on('focus', (evt) => {
const oldValue = valueGetter(); const oldValue = valueGetter();
if (jqueryNode.val() !== oldValue) { if (jqueryNode.val() !== oldValue) {
jqueryNode.val(oldValue); jqueryNode.val(oldValue);
} }
jqueryNode.addClass('editactive').removeClass('editempty'); jqueryNode.addClass('editactive').removeClass('editempty');
}); });
jqueryNode.bind('blur', (evt) => { jqueryNode.on('blur', (evt) => {
const newValue = jqueryNode.removeClass('editactive').val(); const newValue = jqueryNode.removeClass('editactive').val();
valueSetter(newValue); valueSetter(newValue);
}); });
padutils.bindEnterAndEscape(jqueryNode, () => { padutils.bindEnterAndEscape(jqueryNode, () => {
jqueryNode.blur(); jqueryNode.trigger('blur');
}, () => { }, () => {
jqueryNode.val(valueGetter()).blur(); jqueryNode.val(valueGetter()).trigger('blur');
}); });
jqueryNode.removeAttr('disabled').addClass('editable'); jqueryNode.prop('disabled', false).addClass('editable');
}; };
let pad = undefined; let pad = undefined;
@ -369,15 +369,15 @@ const paduserlist = (() => {
}); });
// color picker // color picker
$('#myswatchbox').click(showColorPicker); $('#myswatchbox').on('click', showColorPicker);
$('#mycolorpicker .pickerswatchouter').click(function () { $('#mycolorpicker .pickerswatchouter').on('click', function () {
$('#mycolorpicker .pickerswatchouter').removeClass('picked'); $('#mycolorpicker .pickerswatchouter').removeClass('picked');
$(this).addClass('picked'); $(this).addClass('picked');
}); });
$('#mycolorpickersave').click(() => { $('#mycolorpickersave').on('click', () => {
closeColorPicker(true); closeColorPicker(true);
}); });
$('#mycolorpickercancel').click(() => { $('#mycolorpickercancel').on('click', () => {
closeColorPicker(false); closeColorPicker(false);
}); });
// //
@ -587,7 +587,7 @@ const showColorPicker = () => {
li.appendTo(colorsList); li.appendTo(colorsList);
li.bind('click', (event) => { li.on('click', (event) => {
$('#colorpickerswatches li').removeClass('picked'); $('#colorpickerswatches li').removeClass('picked');
$(event.target).addClass('picked'); $(event.target).addClass('picked');

View file

@ -224,7 +224,7 @@ const padutils = {
// It is work on Windows (IE8, Chrome 6.0.472), CentOs (Firefox 3.0) and Mac OSX (Firefox // It is work on Windows (IE8, Chrome 6.0.472), CentOs (Firefox 3.0) and Mac OSX (Firefox
// 3.6.10, Chrome 6.0.472, Safari 5.0). // 3.6.10, Chrome 6.0.472, Safari 5.0).
if (onEnter) { if (onEnter) {
node.keypress((evt) => { node.on('keypress', (evt) => {
if (evt.which === 13) { if (evt.which === 13) {
onEnter(evt); onEnter(evt);
} }
@ -232,7 +232,7 @@ const padutils = {
} }
if (onEscape) { if (onEscape) {
node.keydown((evt) => { node.on('keydown', (evt) => {
if (evt.which === 27) { if (evt.which === 27) {
onEscape(evt); onEscape(evt);
} }
@ -299,7 +299,7 @@ const padutils = {
} }
field.removeClass('editempty'); field.removeClass('editempty');
}); });
field.blur(() => { field.on('blur', () => {
if (!field.val()) { if (!field.val()) {
clear(); clear();
} }
@ -313,11 +313,11 @@ const padutils = {
if (value) { if (value) {
$(node).attr('checked', 'checked'); $(node).attr('checked', 'checked');
} else { } else {
$(node).removeAttr('checked'); $(node).prop('checked', false);
} }
}, },
bindCheckboxChange: (node, func) => { bindCheckboxChange: (node, func) => {
$(node).change(func); $(node).on('change', func);
}, },
encodeUserId: (userId) => userId.replace(/[^a-y0-9]/g, (c) => { encodeUserId: (userId) => userId.replace(/[^a-y0-9]/g, (c) => {
if (c === '.') return '-'; if (c === '.') return '-';

View file

@ -46,7 +46,7 @@ if (window.location.hash.toLowerCase() === '#skinvariantsbuilder') {
$('#skin-variant-full-width').prop('checked', $('html').hasClass('full-width-editor')); $('#skin-variant-full-width').prop('checked', $('html').hasClass('full-width-editor'));
}; };
$('.skin-variant').change(() => { $('.skin-variant').on('change', () => {
updateSkinVariantsClasses(); updateSkinVariantsClasses();
}); });

View file

@ -82,7 +82,7 @@ const init = () => {
// get all the export links // get all the export links
exportLinks = $('#export > .exportlink'); exportLinks = $('#export > .exportlink');
$('button#forcereconnect').click(() => { $('button#forcereconnect').on('click', () => {
window.location.reload(); window.location.reload();
}); });
@ -159,7 +159,7 @@ const handleClientVars = (message) => {
$('#rightstep').attr('title', html10n.get('timeslider.forwardRevision')); $('#rightstep').attr('title', html10n.get('timeslider.forwardRevision'));
// font family change // font family change
$('#viewfontmenu').change(function () { $('#viewfontmenu').on('change', function () {
$('#innerdocbody').css('font-family', $(this).val() || ''); $('#innerdocbody').css('font-family', $(this).val() || '');
}); });
}; };

View file

@ -33,7 +33,7 @@ $._farbtastic = function (container, options) {
fb.linkTo = function (callback) { fb.linkTo = function (callback) {
// Unbind previous nodes // Unbind previous nodes
if (typeof fb.callback == 'object') { if (typeof fb.callback == 'object') {
$(fb.callback).unbind('keyup', fb.updateValue); $(fb.callback).off('keyup').on('keyup').on('keyup', fb.updateValue);
} }
// Reset color // Reset color
@ -45,7 +45,7 @@ $._farbtastic = function (container, options) {
} }
else if (typeof callback == 'object' || typeof callback == 'string') { else if (typeof callback == 'object' || typeof callback == 'string') {
fb.callback = $(callback); fb.callback = $(callback);
fb.callback.bind('keyup', fb.updateValue); fb.callback.on('keyup', fb.updateValue);
if (fb.callback[0].value) { if (fb.callback[0].value) {
fb.setColor(fb.callback[0].value); fb.setColor(fb.callback[0].value);
} }
@ -388,7 +388,7 @@ $._farbtastic = function (container, options) {
fb.mousedown = function (event) { fb.mousedown = function (event) {
// Capture mouse // Capture mouse
if (!$._farbtastic.dragging) { if (!$._farbtastic.dragging) {
$(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); $(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup);
$._farbtastic.dragging = true; $._farbtastic.dragging = true;
} }
@ -429,8 +429,8 @@ $._farbtastic = function (container, options) {
*/ */
fb.mouseup = function () { fb.mouseup = function () {
// Uncapture mouse // Uncapture mouse
$(document).unbind('mousemove', fb.mousemove); $(document).off('mousemove').on('mousemove',fb.mousemove);
$(document).unbind('mouseup', fb.mouseup); $(document).off('mouseup').on('mouseup', fb.mouseup);
$._farbtastic.dragging = false; $._farbtastic.dragging = false;
} }
@ -519,7 +519,7 @@ $._farbtastic = function (container, options) {
fb.initWidget(); fb.initWidget();
// Install mousedown handler (the others are set on the document on-demand) // Install mousedown handler (the others are set on the document on-demand)
$('canvas.farbtastic-overlay', container).mousedown(fb.mousedown); $('canvas.farbtastic-overlay', container).on('mousedown',fb.mousedown);
// Set linked elements/callback // Set linked elements/callback
if (options.callback) { if (options.callback) {

File diff suppressed because it is too large Load diff

View file

@ -123,7 +123,7 @@
$dropdown.find('.list').css('max-height', $maxListHeight + 'px'); $dropdown.find('.list').css('max-height', $maxListHeight + 'px');
} else { } else {
$dropdown.focus(); $dropdown.trigger('focus');
} }
}); });

View file

@ -2,6 +2,6 @@
window.customStart = () => { window.customStart = () => {
$('#pad_title').show(); $('#pad_title').show();
$('.buttonicon').mousedown(function () { $(this).parent().addClass('pressed'); }); $('.buttonicon').on('mousedown', function () { $(this).parent().addClass('pressed'); });
$('.buttonicon').mouseup(function () { $(this).parent().removeClass('pressed'); }); $('.buttonicon').on('mouseup', function () { $(this).parent().removeClass('pressed'); });
}; };

View file

@ -122,7 +122,7 @@
<% e.begin_block("mySettings"); %> <% e.begin_block("mySettings"); %>
<h2 data-l10n-id="pad.settings.myView"></h2> <h2 data-l10n-id="pad.settings.myView"></h2>
<p class="hide-for-mobile"> <p class="hide-for-mobile">
<input type="checkbox" id="options-stickychat" onClick="chat.stickToScreen();"> <input type="checkbox" id="options-stickychat">
<label for="options-stickychat" data-l10n-id="pad.settings.stickychat"></label> <label for="options-stickychat" data-l10n-id="pad.settings.stickychat"></label>
</p> </p>
<p class="hide-for-mobile"> <p class="hide-for-mobile">

View file

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

View file

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

View file

@ -27,7 +27,7 @@ describe('Admin > Settings', function () {
observer.observe( observer.observe(
helper.admin$('#response')[0], {attributes: true, childList: false, subtree: false}); helper.admin$('#response')[0], {attributes: true, childList: false, subtree: false});
}); });
helper.admin$('#saveSettings').click(); helper.admin$('#saveSettings').trigger('click');
await p; await p;
}; };
@ -80,8 +80,8 @@ describe('Admin > Settings', function () {
await helper.waitForPromise(async () => { await helper.waitForPromise(async () => {
oldStartTime = await getStartTime(); oldStartTime = await getStartTime();
return oldStartTime != null && oldStartTime > 0; return oldStartTime != null && oldStartTime > 0;
}, 1000, 500); }, 2100, 500);
helper.admin$('#restartEtherpad').click(); helper.admin$('#restartEtherpad').trigger('click');
await helper.waitForPromise(async () => { await helper.waitForPromise(async () => {
const startTime = await getStartTime(); const startTime = await getStartTime();
return startTime != null && startTime > oldStartTime; return startTime != null && startTime > oldStartTime;

View file

@ -56,7 +56,7 @@ describe('Plugins page', function () {
await timeout(500); // HACK! Please submit better fix.. await timeout(500); // HACK! Please submit better fix..
const $doUpdateButton = helper.admin$('.ep_align .do-update'); const $doUpdateButton = helper.admin$('.ep_align .do-update');
$doUpdateButton.click(); $doUpdateButton.trigger('click');
// ensure its showing as Updating // ensure its showing as Updating
await helper.waitForPromise( await helper.waitForPromise(
@ -79,7 +79,7 @@ describe('Plugins page', function () {
// skip if we already have ep_headings2 installed.. // skip if we already have ep_headings2 installed..
if (helper.admin$('.ep_headings2 .do-install').is(':visible') === false) this.skip(); if (helper.admin$('.ep_headings2 .do-install').is(':visible') === false) this.skip();
helper.admin$('.ep_headings2 .do-install').click(); helper.admin$('.ep_headings2 .do-install').trigger('click');
// ensure install has attempted to be started // ensure install has attempted to be started
await helper.waitForPromise( await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .do-install').length !== 0, 120000); () => helper.admin$('.ep_headings2 .do-install').length !== 0, 120000);
@ -96,7 +96,7 @@ describe('Plugins page', function () {
await helper.waitForPromise( await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000); () => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000);
helper.admin$('.ep_headings2 .do-uninstall').click(); helper.admin$('.ep_headings2 .do-uninstall').trigger('click');
// ensure its showing uninstalling // ensure its showing uninstalling
await helper.waitForPromise( await helper.waitForPromise(

View file

@ -25,7 +25,7 @@ describe('author of pad edition', function () {
$lineWithUnorderedList.sendkeys('{selectall}'); $lineWithUnorderedList.sendkeys('{selectall}');
const $insertUnorderedListButton = helper.padChrome$('.buttonicon-insertunorderedlist'); const $insertUnorderedListButton = helper.padChrome$('.buttonicon-insertunorderedlist');
$insertUnorderedListButton.click(); $insertUnorderedListButton.trigger('click');
await helper.waitForPromise(() => ( await helper.waitForPromise(() => (
getLine(LINE_WITH_UNORDERED_LIST).find('ul li').length === 1 && getLine(LINE_WITH_UNORDERED_LIST).find('ul li').length === 1 &&
@ -36,7 +36,7 @@ describe('author of pad edition', function () {
$lineWithOrderedList.sendkeys('{selectall}'); $lineWithOrderedList.sendkeys('{selectall}');
const $insertOrderedListButton = helper.padChrome$('.buttonicon-insertorderedlist'); const $insertOrderedListButton = helper.padChrome$('.buttonicon-insertorderedlist');
$insertOrderedListButton.click(); $insertOrderedListButton.trigger('click');
await helper.waitForPromise(() => ( await helper.waitForPromise(() => (
getLine(LINE_WITH_ORDERED_LIST).find('ol li').length === 1 && getLine(LINE_WITH_ORDERED_LIST).find('ol li').length === 1 &&

View file

@ -18,7 +18,7 @@ describe('bold button', function () {
// get the bold button and click it // get the bold button and click it
const $boldButton = chrome$('.buttonicon-bold'); const $boldButton = chrome$('.buttonicon-bold');
$boldButton.click(); $boldButton.trigger('click');
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();

View file

@ -13,10 +13,10 @@ describe('change user color', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
let $userButton = chrome$('.buttonicon-showusers'); let $userButton = chrome$('.buttonicon-showusers');
$userButton.click(); $userButton.trigger('click');
let $userSwatch = chrome$('#myswatch'); let $userSwatch = chrome$('#myswatch');
$userSwatch.click(); $userSwatch.trigger('click');
const fb = chrome$.farbtastic('#colorpicker'); const fb = chrome$.farbtastic('#colorpicker');
const $colorPickerSave = chrome$('#mycolorpickersave'); const $colorPickerSave = chrome$('#mycolorpickersave');
@ -34,7 +34,7 @@ describe('change user color', function () {
// The swatch updates as the test color is picked. // The swatch updates as the test color is picked.
fb.setColor(testColorHash); fb.setColor(testColorHash);
expect($colorPickerPreview.css('background-color')).to.be(testColorRGB); expect($colorPickerPreview.css('background-color')).to.be(testColorRGB);
$colorPickerSave.click(); $colorPickerSave.trigger('click');
expect($userSwatch.css('background-color')).to.be(testColorRGB); expect($userSwatch.css('background-color')).to.be(testColorRGB);
// give it a second to save the color on the server side // give it a second to save the color on the server side
@ -47,10 +47,10 @@ describe('change user color', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
$userButton = chrome$('.buttonicon-showusers'); $userButton = chrome$('.buttonicon-showusers');
$userButton.click(); $userButton.trigger('click');
$userSwatch = chrome$('#myswatch'); $userSwatch = chrome$('#myswatch');
$userSwatch.click(); $userSwatch.trigger('click');
$colorPickerPreview = chrome$('#mycolorpickerpreview'); $colorPickerPreview = chrome$('#mycolorpickerpreview');
@ -64,15 +64,15 @@ describe('change user color', function () {
const $colorOption = helper.padChrome$('#options-colorscheck'); const $colorOption = helper.padChrome$('#options-colorscheck');
if (!$colorOption.is(':checked')) { if (!$colorOption.is(':checked')) {
$colorOption.click(); $colorOption.trigger('click');
} }
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $userButton = chrome$('.buttonicon-showusers'); const $userButton = chrome$('.buttonicon-showusers');
$userButton.click(); $userButton.trigger('click');
const $userSwatch = chrome$('#myswatch'); const $userSwatch = chrome$('#myswatch');
$userSwatch.click(); $userSwatch.trigger('click');
const fb = chrome$.farbtastic('#colorpicker'); const fb = chrome$.farbtastic('#colorpicker');
const $colorPickerSave = chrome$('#mycolorpickersave'); const $colorPickerSave = chrome$('#mycolorpickersave');
@ -82,11 +82,11 @@ describe('change user color', function () {
const testColorRGB = 'rgb(171, 205, 239)'; const testColorRGB = 'rgb(171, 205, 239)';
fb.setColor(testColorHash); fb.setColor(testColorHash);
$colorPickerSave.click(); $colorPickerSave.trigger('click');
// click on the chat button to make chat visible // click on the chat button to make chat visible
const $chatButton = chrome$('#chaticon'); const $chatButton = chrome$('#chaticon');
$chatButton.click(); $chatButton.trigger('click');
const $chatInput = chrome$('#chatinput'); const $chatInput = chrome$('#chatinput');
$chatInput.sendkeys('O hi'); // simulate a keypress of typing user $chatInput.sendkeys('O hi'); // simulate a keypress of typing user
$chatInput.sendkeys('{enter}'); $chatInput.sendkeys('{enter}');

View file

@ -10,7 +10,7 @@ describe('chat-load-messages', function () {
it('adds a lot of messages', async function () { it('adds a lot of messages', async function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.trigger('click');
const chatInput = chrome$('#chatinput'); const chatInput = chrome$('#chatinput');
const chatText = chrome$('#chattext'); const chatText = chrome$('#chattext');
@ -33,7 +33,7 @@ describe('chat-load-messages', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
helper.waitFor(() => { helper.waitFor(() => {
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.trigger('click');
chatText = chrome$('#chattext'); chatText = chrome$('#chattext');
return chatText.children('p').length === expectedCount; return chatText.children('p').length === expectedCount;
}).always(() => { }).always(() => {
@ -47,11 +47,11 @@ describe('chat-load-messages', function () {
const expectedCount = 122; const expectedCount = 122;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.trigger('click');
const chatText = chrome$('#chattext'); const chatText = chrome$('#chattext');
const loadMsgBtn = chrome$('#chatloadmessagesbutton'); const loadMsgBtn = chrome$('#chatloadmessagesbutton');
loadMsgBtn.click(); loadMsgBtn.trigger('click');
helper.waitFor(() => chatText.children('p').length === expectedCount).always(() => { helper.waitFor(() => chatText.children('p').length === expectedCount).always(() => {
expect(chatText.children('p').length).to.be(expectedCount); expect(chatText.children('p').length).to.be(expectedCount);
done(); done();
@ -63,11 +63,11 @@ describe('chat-load-messages', function () {
const expectedDisplay = 'none'; const expectedDisplay = 'none';
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.trigger('click');
const loadMsgBtn = chrome$('#chatloadmessagesbutton'); const loadMsgBtn = chrome$('#chatloadmessagesbutton');
const loadMsgBall = chrome$('#chatloadmessagesball'); const loadMsgBall = chrome$('#chatloadmessagesball');
loadMsgBtn.click(); loadMsgBtn.trigger('click');
helper.waitFor(() => loadMsgBtn.css('display') === expectedDisplay && helper.waitFor(() => loadMsgBtn.css('display') === expectedDisplay &&
loadMsgBall.css('display') === expectedDisplay).always(() => { loadMsgBall.css('display') === expectedDisplay).always(() => {
expect(loadMsgBtn.css('display')).to.be(expectedDisplay); expect(loadMsgBtn.css('display')).to.be(expectedDisplay);

View file

@ -32,11 +32,11 @@ describe('clear authorship colors button', function () {
() => inner$('div span').first().attr('class').indexOf('author') !== -1); () => inner$('div span').first().attr('class').indexOf('author') !== -1);
// IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship // IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship
inner$('div').first().focus(); inner$('div').first().trigger('focus');
// get the clear authorship colors button and click it // get the clear authorship colors button and click it
const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship'); const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship');
$clearauthorshipcolorsButton.click(); $clearauthorshipcolorsButton.trigger('click');
// does the first div include an author class? // does the first div include an author class?
const hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1; const hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1;
@ -70,11 +70,11 @@ describe('clear authorship colors button', function () {
() => inner$('div span').first().attr('class').indexOf('author') !== -1); () => inner$('div span').first().attr('class').indexOf('author') !== -1);
// IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship // IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship
inner$('div').first().focus(); inner$('div').first().trigger('focus');
// get the clear authorship colors button and click it // get the clear authorship colors button and click it
const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship'); const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship');
$clearauthorshipcolorsButton.click(); $clearauthorshipcolorsButton.trigger('click');
// does the first div include an author class? // does the first div include an author class?
let hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1; let hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1;
@ -93,7 +93,7 @@ describe('clear authorship colors button', function () {
const $undoButton = chrome$('.buttonicon-undo'); const $undoButton = chrome$('.buttonicon-undo');
// click the button // click the button
$undoButton.click(); // shouldn't do anything $undoButton.trigger('click'); // shouldn't do anything
hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1; hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1;
expect(hasAuthorClass).to.be(false); expect(hasAuthorClass).to.be(false);

View file

@ -24,7 +24,7 @@ describe('drag and drop', function () {
before(async function () { before(async function () {
const originalHTML = helper.padInner$('body').html(); const originalHTML = helper.padInner$('body').html();
const $undoButton = helper.padChrome$('.buttonicon-undo'); const $undoButton = helper.padChrome$('.buttonicon-undo');
$undoButton.click(); $undoButton.trigger('click');
await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML); await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML);
}); });
@ -59,7 +59,7 @@ describe('drag and drop', function () {
before(async function () { before(async function () {
const originalHTML = helper.padInner$('body').html(); const originalHTML = helper.padInner$('body').html();
const $undoButton = helper.padChrome$('.buttonicon-undo'); const $undoButton = helper.padChrome$('.buttonicon-undo');
$undoButton.click(); $undoButton.trigger('click');
await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML); await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML);
}); });

View file

@ -59,7 +59,7 @@ describe('embed links', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
chrome$('.buttonicon-embed').click(); chrome$('.buttonicon-embed').trigger('click');
// get the link of the share field + the actual pad url and compare them // get the link of the share field + the actual pad url and compare them
const shareLink = chrome$('#linkinput').val(); const shareLink = chrome$('#linkinput').val();
@ -73,7 +73,7 @@ describe('embed links', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
chrome$('.buttonicon-embed').click(); chrome$('.buttonicon-embed').trigger('click');
// get the link of the share field + the actual pad url and compare them // get the link of the share field + the actual pad url and compare them
const embedCode = chrome$('#embedinput').val(); const embedCode = chrome$('#embedinput').val();
@ -93,8 +93,8 @@ describe('embed links', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
chrome$('.buttonicon-embed').click(); chrome$('.buttonicon-embed').trigger('click');
chrome$('#readonlyinput').click(); chrome$('#readonlyinput').trigger('click');
chrome$('#readonlyinput:checkbox:not(:checked)').attr('checked', 'checked'); chrome$('#readonlyinput:checkbox:not(:checked)').attr('checked', 'checked');
// get the link of the share field + the actual pad url and compare them // get the link of the share field + the actual pad url and compare them
@ -109,9 +109,9 @@ describe('embed links', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
chrome$('.buttonicon-embed').click(); chrome$('.buttonicon-embed').trigger('click');
// check read only checkbox, a bit hacky // check read only checkbox, a bit hacky
chrome$('#readonlyinput').click(); chrome$('#readonlyinput').trigger('click');
chrome$('#readonlyinput:checkbox:not(:checked)').attr('checked', 'checked'); chrome$('#readonlyinput:checkbox:not(:checked)').attr('checked', 'checked');

View file

@ -12,7 +12,7 @@ describe('font select', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $settingsButton = chrome$('.buttonicon-settings'); const $settingsButton = chrome$('.buttonicon-settings');
$settingsButton.click(); $settingsButton.trigger('click');
// get the font menu and RobotoMono option // get the font menu and RobotoMono option
const $viewfontmenu = chrome$('#viewfontmenu'); const $viewfontmenu = chrome$('#viewfontmenu');
@ -21,7 +21,7 @@ describe('font select', function () {
// $RobotoMonooption.attr('selected','selected'); // $RobotoMonooption.attr('selected','selected');
// commenting out above will break safari test // commenting out above will break safari test
$viewfontmenu.val('RobotoMono'); $viewfontmenu.val('RobotoMono');
$viewfontmenu.change(); $viewfontmenu.trigger('change');
// check if font changed to RobotoMono // check if font changed to RobotoMono
const fontFamily = inner$('body').css('font-family').toLowerCase(); const fontFamily = inner$('body').css('font-family').toLowerCase();

View file

@ -47,13 +47,13 @@ describe('the test helper', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
let $userButton = chrome$('.buttonicon-showusers'); let $userButton = chrome$('.buttonicon-showusers');
$userButton.click(); $userButton.trigger('click');
let $usernameInput = chrome$('#myusernameedit'); let $usernameInput = chrome$('#myusernameedit');
$usernameInput.click(); $usernameInput.trigger('click');
$usernameInput.val('John McLear'); $usernameInput.val('John McLear');
$usernameInput.blur(); $usernameInput.trigger('blur');
// Before refreshing, make sure the name is there // Before refreshing, make sure the name is there
expect($usernameInput.val()).to.be('John McLear'); expect($usernameInput.val()).to.be('John McLear');
@ -85,7 +85,7 @@ describe('the test helper', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
$userButton = chrome$('.buttonicon-showusers'); $userButton = chrome$('.buttonicon-showusers');
$userButton.click(); $userButton.trigger('click');
// confirm that the session was actually cleared // confirm that the session was actually cleared
$usernameInput = chrome$('#myusernameedit'); $usernameInput = chrome$('#myusernameedit');

View file

@ -527,7 +527,7 @@ describe('importexport.js', function () {
const isVisible = () => popup.hasClass('popup-show'); const isVisible = () => popup.hasClass('popup-show');
if (isVisible()) return; if (isVisible()) return;
const button = helper.padChrome$('button[data-l10n-id="pad.toolbar.import_export.title"]'); const button = helper.padChrome$('button[data-l10n-id="pad.toolbar.import_export.title"]');
button.click(); button.trigger('click');
await helper.waitForPromise(isVisible); await helper.waitForPromise(isVisible);
}); });
@ -558,7 +558,7 @@ describe('importexport.js', function () {
dt.items.add(new File([contents], `file.${ext}`, {type: 'text/plain'})); dt.items.add(new File([contents], `file.${ext}`, {type: 'text/plain'}));
const form = helper.padChrome$('#importform'); const form = helper.padChrome$('#importform');
form.find('input[type=file]')[0].files = dt.files; form.find('input[type=file]')[0].files = dt.files;
form.find('#importsubmitinput').submit(); form.find('#importsubmitinput').trigger('submit');
try { try {
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const got = helper.linesDiv(); const got = helper.linesDiv();

View file

@ -27,7 +27,7 @@ describe('indentation button', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $indentButton = chrome$('.buttonicon-indent'); const $indentButton = chrome$('.buttonicon-indent');
$indentButton.click(); $indentButton.trigger('click');
await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 1); await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 1);
}); });
@ -38,7 +38,7 @@ describe('indentation button', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $indentButton = chrome$('.buttonicon-indent'); const $indentButton = chrome$('.buttonicon-indent');
$indentButton.click(); $indentButton.trigger('click');
// type a bit, make a line break and type again // type a bit, make a line break and type again
const $firstTextElement = inner$('div span').first(); const $firstTextElement = inner$('div span').first();
@ -147,19 +147,19 @@ describe('indentation button', function () {
helper.selectLines($firstLine, $secondLine); helper.selectLines($firstLine, $secondLine);
const $indentButton = chrome$('.buttonicon-indent'); const $indentButton = chrome$('.buttonicon-indent');
$indentButton.click(); $indentButton.trigger('click');
await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 1); await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 1);
// apply bold // apply bold
const $boldButton = chrome$('.buttonicon-bold'); const $boldButton = chrome$('.buttonicon-bold');
$boldButton.click(); $boldButton.trigger('click');
await helper.waitForPromise(() => inner$('div').first().find('b').length === 1); await helper.waitForPromise(() => inner$('div').first().find('b').length === 1);
// outdent first 2 lines // outdent first 2 lines
const $outdentButton = chrome$('.buttonicon-outdent'); const $outdentButton = chrome$('.buttonicon-outdent');
$outdentButton.click(); $outdentButton.trigger('click');
await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 0); await helper.waitForPromise(() => inner$('div').first().find('ul li').length === 0);
// check if '*' is displayed // check if '*' is displayed
@ -179,7 +179,7 @@ describe('indentation button', function () {
// get the indentation button and click it // get the indentation button and click it
const $indentButton = helper.$getPadChrome().find('.buttonicon-indent'); const $indentButton = helper.$getPadChrome().find('.buttonicon-indent');
$indentButton.click(); $indentButton.trigger('click');
let newFirstTextElement = $inner.find('div').first(); let newFirstTextElement = $inner.find('div').first();
@ -196,7 +196,7 @@ describe('indentation button', function () {
expect(isLI).to.be(true); expect(isLI).to.be(true);
// indent again // indent again
$indentButton.click(); $indentButton.trigger('click');
newFirstTextElement = $inner.find('div').first(); newFirstTextElement = $inner.find('div').first();
@ -215,8 +215,8 @@ describe('indentation button', function () {
// get the unindentation button and click it twice // get the unindentation button and click it twice
const $outdentButton = helper.$getPadChrome().find('.buttonicon-outdent'); const $outdentButton = helper.$getPadChrome().find('.buttonicon-outdent');
$outdentButton.click(); $outdentButton.trigger('click');
$outdentButton.click(); $outdentButton.trigger('click');
newFirstTextElement = $inner.find('div').first(); newFirstTextElement = $inner.find('div').first();
@ -242,8 +242,8 @@ describe('indentation button', function () {
helper.selectText(firstTextElement[0], $inner); helper.selectText(firstTextElement[0], $inner);
// indent twice // indent twice
$indentButton.click(); $indentButton.trigger('click');
$indentButton.click(); $indentButton.trigger('click');
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
firstTextElement = $inner.find('div').first(); firstTextElement = $inner.find('div').first();

View file

@ -18,7 +18,7 @@ describe('italic some text', function () {
// get the bold button and click it // get the bold button and click it
const $boldButton = chrome$('.buttonicon-italic'); const $boldButton = chrome$('.buttonicon-italic');
$boldButton.click(); $boldButton.trigger('click');
// ace creates a new dom element when you press a button, just get the first text element again // ace creates a new dom element when you press a button, just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();

View file

@ -16,7 +16,7 @@ describe('Language select and change', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $settingsButton = chrome$('.buttonicon-settings'); const $settingsButton = chrome$('.buttonicon-settings');
$settingsButton.click(); $settingsButton.trigger('click');
// click the language button // click the language button
const $language = chrome$('#languagemenu'); const $language = chrome$('#languagemenu');
@ -24,7 +24,7 @@ describe('Language select and change', function () {
// select german // select german
$languageoption.attr('selected', 'selected'); $languageoption.attr('selected', 'selected');
$language.change(); $language.trigger('change');
await helper.waitForPromise( await helper.waitForPromise(
() => chrome$('.buttonicon-bold').parent()[0].title === 'Fett (Strg-B)'); () => chrome$('.buttonicon-bold').parent()[0].title === 'Fett (Strg-B)');
@ -45,13 +45,13 @@ describe('Language select and change', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $settingsButton = chrome$('.buttonicon-settings'); const $settingsButton = chrome$('.buttonicon-settings');
$settingsButton.click(); $settingsButton.trigger('click');
// click the language button // click the language button
const $language = chrome$('#languagemenu'); const $language = chrome$('#languagemenu');
// select english // select english
$language.val('en'); $language.val('en');
$language.change(); $language.trigger('change');
// get the value of the bold button // get the value of the bold button
let $boldButton = chrome$('.buttonicon-bold').parent(); let $boldButton = chrome$('.buttonicon-bold').parent();
@ -79,7 +79,7 @@ describe('Language select and change', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $settingsButton = chrome$('.buttonicon-settings'); const $settingsButton = chrome$('.buttonicon-settings');
$settingsButton.click(); $settingsButton.trigger('click');
// click the language button // click the language button
const $language = chrome$('#languagemenu'); const $language = chrome$('#languagemenu');
@ -88,7 +88,7 @@ describe('Language select and change', function () {
// select arabic // select arabic
// $languageoption.attr('selected','selected'); // Breaks the test.. // $languageoption.attr('selected','selected'); // Breaks the test..
$language.val('ar'); $language.val('ar');
$languageoption.change(); $languageoption.trigger('change');
await helper.waitForPromise(() => chrome$('html')[0].dir !== 'ltr'); await helper.waitForPromise(() => chrome$('html')[0].dir !== 'ltr');
@ -101,7 +101,7 @@ describe('Language select and change', function () {
// click on the settings button to make settings visible // click on the settings button to make settings visible
const $settingsButton = chrome$('.buttonicon-settings'); const $settingsButton = chrome$('.buttonicon-settings');
$settingsButton.click(); $settingsButton.trigger('click');
// click the language button // click the language button
const $language = chrome$('#languagemenu'); const $language = chrome$('#languagemenu');
@ -111,7 +111,7 @@ describe('Language select and change', function () {
// select arabic // select arabic
$languageoption.attr('selected', 'selected'); $languageoption.attr('selected', 'selected');
$language.val('en'); $language.val('en');
$languageoption.change(); $languageoption.trigger('change');
await helper.waitForPromise(() => chrome$('html')[0].dir !== 'rtl'); await helper.waitForPromise(() => chrome$('html')[0].dir !== 'rtl');

View file

@ -33,7 +33,7 @@ describe('author of pad edition', function () {
// get the clear authorship colors button and click it // get the clear authorship colors button and click it
const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship'); const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship');
$clearauthorshipcolorsButton.click(); $clearauthorshipcolorsButton.trigger('click');
// does the first divs span include an author class? // does the first divs span include an author class?
const hasAuthorClass = inner$('div span').first().attr('class').indexOf('author') !== -1; const hasAuthorClass = inner$('div span').first().attr('class').indexOf('author') !== -1;

View file

@ -12,7 +12,7 @@ describe('ordered_list.js', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
await helper.waitForPromise(() => inner$('div').first().find('ol li').length === 1); await helper.waitForPromise(() => inner$('div').first().find('ol li').length === 1);
}); });
@ -115,10 +115,10 @@ describe('ordered_list.js', function () {
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
const $firstLine = inner$('div').first(); const $firstLine = inner$('div').first();
$firstLine.sendkeys('{selectall}'); $firstLine.sendkeys('{selectall}');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
const $secondLine = inner$('div').first().next(); const $secondLine = inner$('div').first().next();
$secondLine.sendkeys('{selectall}'); $secondLine.sendkeys('{selectall}');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
expect($secondLine.find('ol').attr('start') === 2); expect($secondLine.find('ol').attr('start') === 2);
}); });
@ -128,7 +128,7 @@ describe('ordered_list.js', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
// type a bit, make a line break and type again // type a bit, make a line break and type again
const $firstTextElement = inner$('div span').first(); const $firstTextElement = inner$('div span').first();
@ -182,7 +182,7 @@ describe('ordered_list.js', function () {
$firstTextElement.sendkeys('{selectall}'); $firstTextElement.sendkeys('{selectall}');
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
const e = new inner$.Event(helper.evtType); const e = new inner$.Event(helper.evtType);
e.keyCode = 9; // tab e.keyCode = 9; // tab
@ -217,15 +217,15 @@ describe('ordered_list.js', function () {
$firstTextElement.sendkeys('{selectall}'); $firstTextElement.sendkeys('{selectall}');
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
const $indentButton = chrome$('.buttonicon-indent'); const $indentButton = chrome$('.buttonicon-indent');
$indentButton.click(); // make it indented twice $indentButton.trigger('click'); // make it indented twice
expect(inner$('div').first().find('.list-number2').length === 1).to.be(true); expect(inner$('div').first().find('.list-number2').length === 1).to.be(true);
const $outdentButton = chrome$('.buttonicon-outdent'); const $outdentButton = chrome$('.buttonicon-outdent');
$outdentButton.click(); // make it deindented to 1 $outdentButton.trigger('click'); // make it deindented to 1
await helper.waitForPromise(() => inner$('div').first().find('.list-number1').length === 1); await helper.waitForPromise(() => inner$('div').first().find('.list-number1').length === 1);
}); });

View file

@ -71,16 +71,16 @@ describe('Pad modal', function () {
const clickOnPadInner = () => { const clickOnPadInner = () => {
const $editor = helper.padInner$('#innerdocbody'); const $editor = helper.padInner$('#innerdocbody');
$editor.click(); $editor.trigger('click');
}; };
const clickOnPadOuter = () => { const clickOnPadOuter = () => {
const $lineNumbersColumn = helper.padOuter$('#sidedivinner'); const $lineNumbersColumn = helper.padOuter$('#sidedivinner');
$lineNumbersColumn.click(); $lineNumbersColumn.trigger('click');
}; };
const openSettingsAndWaitForModalToBeVisible = async () => { const openSettingsAndWaitForModalToBeVisible = async () => {
helper.padChrome$('.buttonicon-settings').click(); helper.padChrome$('.buttonicon-settings').trigger('click');
// wait for modal to be displayed // wait for modal to be displayed
const modalSelector = '#settings'; const modalSelector = '#settings';

View file

@ -22,8 +22,8 @@ describe('undo button then redo button', function () {
const $undoButton = chrome$('.buttonicon-undo'); const $undoButton = chrome$('.buttonicon-undo');
const $redoButton = chrome$('.buttonicon-redo'); const $redoButton = chrome$('.buttonicon-redo');
// click the buttons // click the buttons
$undoButton.click(); // removes foo $undoButton.trigger('click'); // removes foo
$redoButton.click(); // resends foo $redoButton.trigger('click'); // resends foo
await helper.waitForPromise(() => inner$('div span').first().text() === newString); await helper.waitForPromise(() => inner$('div span').first().text() === newString);
const finalValue = inner$('div').first().text(); const finalValue = inner$('div').first().text();

View file

@ -13,7 +13,7 @@ describe('select formatting buttons when selection has style applied', function
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
selectLine(line); selectLine(line);
const $formattingButton = chrome$(`.buttonicon-${style}`); const $formattingButton = chrome$(`.buttonicon-${style}`);
$formattingButton.click(); $formattingButton.trigger('click');
}; };
const isButtonSelected = function (style) { const isButtonSelected = function (style) {
@ -37,7 +37,7 @@ describe('select formatting buttons when selection has style applied', function
const undo = async function () { const undo = async function () {
const originalHTML = helper.padInner$('body').html(); const originalHTML = helper.padInner$('body').html();
const $undoButton = helper.padChrome$('.buttonicon-undo'); const $undoButton = helper.padChrome$('.buttonicon-undo');
$undoButton.click(); $undoButton.trigger('click');
await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML); await helper.waitForPromise(() => helper.padInner$('body').html() !== originalHTML);
}; };

View file

@ -18,7 +18,7 @@ describe('strikethrough button', function () {
// get the strikethrough button and click it // get the strikethrough button and click it
const $strikethroughButton = chrome$('.buttonicon-strikethrough'); const $strikethroughButton = chrome$('.buttonicon-strikethrough');
$strikethroughButton.click(); $strikethroughButton.trigger('click');
// ace creates a new dom element when you press a button, just get the first text element again // ace creates a new dom element when you press a button, just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();

View file

@ -22,7 +22,7 @@ xdescribe('timeslider button takes you to the timeslider of a pad', function ()
await helper.waitForPromise(() => modifiedValue !== originalValue); await helper.waitForPromise(() => modifiedValue !== originalValue);
const $timesliderButton = chrome$('#timesliderlink'); const $timesliderButton = chrome$('#timesliderlink');
$timesliderButton.click(); // So click the timeslider link $timesliderButton.trigger('click'); // So click the timeslider link
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const iFrameURL = chrome$.window.location.href; const iFrameURL = chrome$.window.location.href;

View file

@ -25,7 +25,7 @@ describe('timeslider follow', function () {
// set to follow contents as it arrives // set to follow contents as it arrives
helper.contentWindow().$('#options-followContents').prop('checked', true); helper.contentWindow().$('#options-followContents').prop('checked', true);
helper.contentWindow().$('#playpause_button_icon').click(); helper.contentWindow().$('#playpause_button_icon').trigger('click');
let newTop; let newTop;
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
@ -64,27 +64,27 @@ describe('timeslider follow', function () {
*/ */
// line 40 changed // line 40 changed
helper.contentWindow().$('#leftstep').click(); helper.contentWindow().$('#leftstep').trigger('click');
await helper.waitForPromise(() => hasFollowedToLine(40)); await helper.waitForPromise(() => hasFollowedToLine(40));
// line 1 is the first line that changed // line 1 is the first line that changed
helper.contentWindow().$('#leftstep').click(); helper.contentWindow().$('#leftstep').trigger('click');
await helper.waitForPromise(() => hasFollowedToLine(1)); await helper.waitForPromise(() => hasFollowedToLine(1));
// line 1 changed // line 1 changed
helper.contentWindow().$('#leftstep').click(); helper.contentWindow().$('#leftstep').trigger('click');
await helper.waitForPromise(() => hasFollowedToLine(1)); await helper.waitForPromise(() => hasFollowedToLine(1));
// line 1 changed // line 1 changed
helper.contentWindow().$('#rightstep').click(); helper.contentWindow().$('#rightstep').trigger('click');
await helper.waitForPromise(() => hasFollowedToLine(1)); await helper.waitForPromise(() => hasFollowedToLine(1));
// line 1 is the first line that changed // line 1 is the first line that changed
helper.contentWindow().$('#rightstep').click(); helper.contentWindow().$('#rightstep').trigger('click');
await helper.waitForPromise(() => hasFollowedToLine(1)); await helper.waitForPromise(() => hasFollowedToLine(1));
// line 40 changed // line 40 changed
helper.contentWindow().$('#rightstep').click(); helper.contentWindow().$('#rightstep').trigger('click');
helper.waitForPromise(() => hasFollowedToLine(40)); helper.waitForPromise(() => hasFollowedToLine(40));
}); });
}); });

View file

@ -12,7 +12,7 @@ describe('timeslider', function () {
// Create a bunch of revisions. // Create a bunch of revisions.
for (let i = 0; i < 99; i++) await helper.edit('a'); for (let i = 0; i < 99; i++) await helper.edit('a');
chrome$('.buttonicon-savedRevision').click(); chrome$('.buttonicon-savedRevision').trigger('click');
await helper.waitForPromise(() => helper.padChrome$('.saved-revision').length > 0); await helper.waitForPromise(() => helper.padChrome$('.saved-revision').length > 0);
// Give some time to send the SAVE_REVISION message to the server before navigating away. // Give some time to send the SAVE_REVISION message to the server before navigating away.
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise((resolve) => setTimeout(resolve, 100));

View file

@ -20,7 +20,7 @@ describe('undo button', function () {
// get clear authorship button as a variable // get clear authorship button as a variable
const $undoButton = chrome$('.buttonicon-undo'); const $undoButton = chrome$('.buttonicon-undo');
// click the button // click the button
$undoButton.click(); $undoButton.trigger('click');
await helper.waitForPromise(() => inner$('div span').first().text() === originalValue); await helper.waitForPromise(() => inner$('div span').first().text() === originalValue);
}); });

View file

@ -13,7 +13,7 @@ describe('unordered_list.js', function () {
const originalText = inner$('div').first().text(); const originalText = inner$('div').first().text();
const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist');
$insertunorderedlistButton.click(); $insertunorderedlistButton.trigger('click');
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const newText = inner$('div').first().text(); const newText = inner$('div').first().text();
@ -21,7 +21,7 @@ describe('unordered_list.js', function () {
}); });
// remove indentation by bullet and ensure text string remains the same // remove indentation by bullet and ensure text string remains the same
chrome$('.buttonicon-outdent').click(); chrome$('.buttonicon-outdent').trigger('click');
await helper.waitForPromise(() => inner$('div').first().text() === originalText); await helper.waitForPromise(() => inner$('div').first().text() === originalText);
}); });
}); });
@ -38,7 +38,7 @@ describe('unordered_list.js', function () {
const originalText = inner$('div').first().text(); const originalText = inner$('div').first().text();
const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist');
$insertunorderedlistButton.click(); $insertunorderedlistButton.trigger('click');
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const newText = inner$('div').first().text(); const newText = inner$('div').first().text();
@ -46,7 +46,7 @@ describe('unordered_list.js', function () {
}); });
// remove indentation by bullet and ensure text string remains the same // remove indentation by bullet and ensure text string remains the same
$insertunorderedlistButton.click(); $insertunorderedlistButton.trigger('click');
await helper.waitForPromise(() => inner$('div').find('ul').length !== 1); await helper.waitForPromise(() => inner$('div').find('ul').length !== 1);
}); });
}); });
@ -63,7 +63,7 @@ describe('unordered_list.js', function () {
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
// type a bit, make a line break and type again // type a bit, make a line break and type again
const $firstTextElement = inner$('div span').first(); const $firstTextElement = inner$('div span').first();
@ -98,7 +98,7 @@ describe('unordered_list.js', function () {
$firstTextElement.sendkeys('{selectall}'); $firstTextElement.sendkeys('{selectall}');
const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist');
$insertorderedlistButton.click(); $insertorderedlistButton.trigger('click');
const e = new inner$.Event(helper.evtType); const e = new inner$.Event(helper.evtType);
e.keyCode = 9; // tab e.keyCode = 9; // tab
@ -131,14 +131,14 @@ describe('unordered_list.js', function () {
$firstTextElement.sendkeys('{selectall}'); $firstTextElement.sendkeys('{selectall}');
const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist');
$insertunorderedlistButton.click(); $insertunorderedlistButton.trigger('click');
const $indentButton = chrome$('.buttonicon-indent'); const $indentButton = chrome$('.buttonicon-indent');
$indentButton.click(); // make it indented twice $indentButton.trigger('click'); // make it indented twice
expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true); expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true);
const $outdentButton = chrome$('.buttonicon-outdent'); const $outdentButton = chrome$('.buttonicon-outdent');
$outdentButton.click(); // make it deindented to 1 $outdentButton.trigger('click'); // make it deindented to 1
await helper.waitForPromise(() => inner$('div').first().find('.list-bullet1').length === 1); await helper.waitForPromise(() => inner$('div').first().find('.list-bullet1').length === 1);
}); });

View file

@ -32,7 +32,7 @@ describe('Automatic pad reload on Force Reconnect message', function () {
context('and user clicks on Cancel', function () { context('and user clicks on Cancel', function () {
beforeEach(async function () { beforeEach(async function () {
const $errorMessageModal = helper.padChrome$('#connectivity .userdup'); const $errorMessageModal = helper.padChrome$('#connectivity .userdup');
$errorMessageModal.find('#cancelreconnect').click(); $errorMessageModal.find('#cancelreconnect').trigger('click');
await helper.waitForPromise( await helper.waitForPromise(
() => helper.padChrome$('#connectivity .userdup').is(':visible') === true); () => helper.padChrome$('#connectivity .userdup').is(':visible') === true);
}); });