spec_app/spec/javascripts/up/modal_spec.js.coffee in unpoly-rails-0.27.1 vs spec_app/spec/javascripts/up/modal_spec.js.coffee in unpoly-rails-0.27.2

- old
+ new

@@ -461,9 +461,26 @@ @respondWith("<div class='inside'>old inside</div>") up.extract('.outside', "<div class='outside'>new outside</div>", origin: $('.inside')) expect($('.outside')).toHaveText('new outside') expect($('.up-modal')).not.toExist() + it 'does not restore the covered URL when auto-closing', (done) -> + up.motion.config.enabled = true + up.modal.config.openDuration = 0 + up.modal.config.closeDuration = 20 + + affix('.outside').text('old outside') + whenModalOpen = up.modal.visit('/path', target: '.inside') + @respondWith("<div class='inside'>old inside</div>") # Populate modal + + whenModalOpen.then -> + up.extract('.outside', "<div class='outside'>new outside</div>", + origin: $('.inside'), history: '/new-location') # Provoke auto-close + + u.setTimer 50, -> + expect(location.href).toEndWith '/new-location' + done() + it 'does not auto-close the modal when a replacement from inside the modal affects a selector inside the modal', -> affix('.outside').text('old outside') up.modal.visit('/path', target: '.inside') @respondWith("<div class='inside'>old inside</div>") up.extract('.inside', "<div class='inside'>new inside</div>", origin: $('.inside'))