From 894ebffcaf3d5fcab957f5e40d1fc94359003d54 Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Fri, 12 May 2017 07:03:40 -0300 Subject: [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. --- src/static/js/pad_editbar.js | 2 +- tests/frontend/specs/pad_modal.js | 12 ++++-------- 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 = $(''); - $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); -- cgit v1.2.3