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
This commit is contained in:
Vincent Petry 2014-01-29 13:08:04 +01:00
parent 85e67be0aa
commit bc598f1919
1 changed files with 12 additions and 1 deletions

View File

@ -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() {