[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.
pull/3182/head
Luiza Pagliari 2017-05-12 07:03:40 -03:00
parent 9176bf9bad
commit 894ebffcaf
2 changed files with 5 additions and 9 deletions

View File

@ -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;

View File

@ -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);