summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiza Pagliari <lpagliari@gmail.com>2017-05-12 07:03:40 -0300
committerLuiza Pagliari <lpagliari@gmail.com>2017-05-12 07:03:40 -0300
commit894ebffcaf3d5fcab957f5e40d1fc94359003d54 (patch)
tree10bd2d5a66ddb0f0fe31a6d400616ef50074f220
parent9176bf9bad8d30828ec7cf215357d5a054842c57 (diff)
downloadetherpad-lite-894ebffcaf3d5fcab957f5e40d1fc94359003d54.zip
[fix] Do not close ANY "force reconnect" message
Fix previous commit. As "force reconnect" buttons have all the same id on DOM, on the previous commit we were only disallowing the first button with that id on DOM -- "userdup" -- to be closed by a click on editor. Casually the tests were using the same error to simulate a "force reconnect", so even the tests were not getting the issue.
-rw-r--r--src/static/js/pad_editbar.js2
-rw-r--r--tests/frontend/specs/pad_modal.js12
2 files changed, 5 insertions, 9 deletions
diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js
index b2aade46..9cf357aa 100644
--- a/src/static/js/pad_editbar.js
+++ b/src/static/js/pad_editbar.js
@@ -271,7 +271,7 @@ var padeditbar = (function()
var module = $("#" + thisModuleName);
//skip any "force reconnect" message
- var isAForceReconnectMessage = module.find('#forcereconnect').is(':visible');
+ var isAForceReconnectMessage = module.find('button#forcereconnect:visible').length > 0;
if(isAForceReconnectMessage)
continue;
diff --git a/tests/frontend/specs/pad_modal.js b/tests/frontend/specs/pad_modal.js
index 15eb8ac8..80752e4b 100644
--- a/tests/frontend/specs/pad_modal.js
+++ b/tests/frontend/specs/pad_modal.js
@@ -1,15 +1,11 @@
describe('Pad modal', function() {
context('when modal is a "force reconnect" message', function() {
- var MODAL_SELECTOR = '#connectivity .userdup';
-
- var padId, $originalPadFrame;
+ var MODAL_SELECTOR = '#connectivity .slowcommit';
beforeEach(function(done) {
- padId = helper.newPad(function() {
- // open same pad on another iframe, to force userdup error
- var $otherIframeWithSamePad = $('<iframe src="/p/' + padId + '" style="height: 1px;"></iframe>');
- $originalPadFrame = $('#iframe-container iframe');
- $otherIframeWithSamePad.insertAfter($originalPadFrame);
+ helper.newPad(function() {
+ // force a "slowcommit" error
+ helper.padChrome$.window.pad.handleChannelStateChange('DISCONNECTED', 'slowcommit');
// wait for modal to be displayed
var $modal = helper.padChrome$(MODAL_SELECTOR);