summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-07-06 13:04:52 +0100
committerSean McGivern <sean@gitlab.com>2016-07-08 13:53:17 +0100
commitc082d92fb959ee2344b90b7fd4e316019452c094 (patch)
treebdfad8463d79f98167b86c4f25957041cb30d693 /spec/features
parent90a6be190feea0966e9ed9b6731d930bcff32d68 (diff)
downloadgitlab-ce-c082d92fb959ee2344b90b7fd4e316019452c094.tar.gz
Allow expanding all diffs at once
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/merge_requests/expand_collapse_diffs_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/features/merge_requests/expand_collapse_diffs_spec.rb b/spec/features/merge_requests/expand_collapse_diffs_spec.rb
index 173ea3720da..f9c89c4ad96 100644
--- a/spec/features/merge_requests/expand_collapse_diffs_spec.rb
+++ b/spec/features/merge_requests/expand_collapse_diffs_spec.rb
@@ -135,4 +135,42 @@ feature 'Expand and collapse diffs', js: true, feature: true do
end
end
end
+
+ context 'expanding all diffs' do
+ before do
+ click_link('Expand all')
+ wait_for_ajax
+ execute_script('window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });')
+ end
+
+ it 'reloads the page with all diffs expanded' do
+ expect(small_diff).to have_selector('.code')
+ expect(small_diff).not_to have_selector('.nothing-here-block')
+
+ expect(large_diff).to have_selector('.code')
+ expect(large_diff).not_to have_selector('.nothing-here-block')
+ end
+
+ context 'collapsing an expanded diff' do
+ before { click_link('small_diff.md') }
+
+ it 'hides the diff content' do
+ expect(small_diff).not_to have_selector('.code')
+ expect(small_diff).to have_selector('.nothing-here-block')
+ end
+
+ context 're-expanding the same diff' do
+ before { click_link('small_diff.md') }
+
+ it 'shows the diff content' do
+ expect(small_diff).to have_selector('.code')
+ expect(small_diff).not_to have_selector('.nothing-here-block')
+ end
+
+ it 'does not make a new HTTP request' do
+ expect(evaluate_script('ajaxUris')).to be_empty
+ end
+ end
+ end
+ end
end