diff options
author | Adam Buckland <adamjbuckland@gmail.com> | 2016-07-27 15:47:23 +0300 |
---|---|---|
committer | Adam Buckland <adamjbuckland@gmail.com> | 2016-08-09 16:08:47 +0300 |
commit | 8abc757539454e13835073318f896796b1a85faf (patch) | |
tree | 78cf0a861e61362016f34751a9bc5d3d79a7070d /spec/features | |
parent | 551ffc0a4d25a381e9f8f6a8d6f2793bb87f3145 (diff) |
Update tree view to sort folders with submodules
Currently trees are sorted in the fashion:
- folders
- files
- submodules
with each section sorted alphabetically
This changes to this system:
- folders and submodules (sorted together)
- files
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/files/files_sort_submodules_with_folders_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb new file mode 100644 index 00000000000..10b91d8990b --- /dev/null +++ b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +feature 'User views files page', feature: true do + include WaitForAjax + + let(:user) { create(:user) } + let(:project) { create(:forked_project_with_submodules) } + + before do + project.team << [user, :master] + login_as user + visit namespace_project_tree_path(project.namespace, project, project.repository.root_ref) + end + + scenario 'user sees folders and submodules sorted together, followed by files' do + rows = all('td.tree-item-file-name').map(&:text) + tree = project.repository.tree + + folders = tree.trees.map(&:name) + files = tree.blobs.map(&:name) + submodules = tree.submodules.map do |submodule| + submodule.name + " @ " + submodule.id[0..7] + end + + sorted_titles = (folders + submodules).sort + files + + expect(rows).to eq(sorted_titles) + end +end |