Skip to content

Commit

Permalink
Merge pull request #151 from Gaurav0/file_deleted_menu_bug
Browse files Browse the repository at this point in the history
Fix file menu shows deleted file bug
  • Loading branch information
Gaurav0 committed Aug 16, 2015
2 parents db81a1b + e2d7515 commit 69be06b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/gist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,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');
}
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/gist-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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..."
Expand Down

0 comments on commit 69be06b

Please sign in to comment.