From bc598f19194e84dab815841dfe4544de1cf6f908 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 29 Jan 2014 13:08:04 +0100 Subject: Updated unit tests for rename action - rename action is now checked inside of ".nametext" element - added test to ensure that display() correctly resets all actions including the rename one --- apps/files/tests/js/fileactionsSpec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js index 23f7b58dcd9..e185cf2f654 100644 --- a/apps/files/tests/js/fileactionsSpec.js +++ b/apps/files/tests/js/fileactionsSpec.js @@ -43,7 +43,18 @@ describe('FileActions tests', function() { // actions defined after cal expect($tr.find('.action[data-action=Download]').length).toEqual(1); - expect($tr.find('.action[data-action=Rename]').length).toEqual(1); + expect($tr.find('.nametext .action[data-action=Rename]').length).toEqual(1); + expect($tr.find('.action.delete').length).toEqual(1); + }); + it('calling display() twice correctly replaces file actions', function() { + var $tr = FileList.addFile('testName.txt', 1234, new Date(), false, false, {download_url: 'test/download/url'}); + + FileActions.display($tr.find('td.filename'), true); + FileActions.display($tr.find('td.filename'), true); + + // actions defined after cal + expect($tr.find('.action[data-action=Download]').length).toEqual(1); + expect($tr.find('.nametext .action[data-action=Rename]').length).toEqual(1); expect($tr.find('.action.delete').length).toEqual(1); }); it('redirects to download URL when clicking download', function() { -- cgit v1.2.3