From e2d751565a11e0daeca338e8e867f06dd7328611 Mon Sep 17 00:00:00 2001 From: Gaurav Munjal Date: Thu, 13 Aug 2015 15:10:21 -0400 Subject: [PATCH] Fix File Menu shows deleted file bug --- app/gist/controller.js | 6 ++++++ tests/acceptance/gist-test.js | 1 + 2 files changed, 7 insertions(+) diff --git a/app/gist/controller.js b/app/gist/controller.js index bbd0bc28..ce67bf53 100644 --- a/app/gist/controller.js +++ b/app/gist/controller.js @@ -169,6 +169,12 @@ export default Ember.Controller.extend({ file.deleteRecord(); this.notify.info('File %@ was deleted'.fmt(file.get('filePath'))); this._removeFileFromColumns(file); + if (this.get('activeFile') === file) { + this.setProperties({ + activeFile: null, + activeEditorCol: null + }); + } this.send('contentsChanged'); } diff --git a/tests/acceptance/gist-test.js b/tests/acceptance/gist-test.js index fb4b1008..1b439c15 100644 --- a/tests/acceptance/gist-test.js +++ b/tests/acceptance/gist-test.js @@ -45,6 +45,7 @@ test('deleting a gist loaded in two columns', function(assert) { andThen(function() { assert.equal(find('.code .CodeMirror').length, 0, 'No code mirror editors active'); assert.equal(find('.dropdown-toggle:contains(No file selected)').length, 2, 'Shows message when no file is selected.'); + assert.equal(find('.file-menu .test-remove-action').length, 0, 'There no longer is a selected file to delete'); }); // TODO: Replace brittle for loop test code with "while there are files left..."