diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 09:08:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 09:08:52 +0000 |
commit | 53ae6b7e3f83591ad251a3f771f5bf3b8cf087ba (patch) | |
tree | 5180b96d6a84f36a515cedfa8e81d72de5ccf4fb /spec/features | |
parent | cfe63cce6a90a1c70397c1b9f6d90480f25cae0a (diff) | |
download | gitlab-ce-53ae6b7e3f83591ad251a3f771f5bf3b8cf087ba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/markdown/mermaid_spec.rb | 30 | ||||
-rw-r--r-- | spec/features/projects/user_uses_shortcuts_spec.rb | 53 |
2 files changed, 83 insertions, 0 deletions
diff --git a/spec/features/markdown/mermaid_spec.rb b/spec/features/markdown/mermaid_spec.rb index 4520d1bb2da..542caccb18d 100644 --- a/spec/features/markdown/mermaid_spec.rb +++ b/spec/features/markdown/mermaid_spec.rb @@ -68,4 +68,34 @@ describe 'Mermaid rendering', :js do expect(page).to have_selector('pre.mermaid') end end + + it 'correctly sizes mermaid diagram inside <details> block', :js do + description = <<~MERMAID + <details> + <summary>Click to show diagram</summary> + + ```mermaid + graph TD; + A-->B; + A-->C; + B-->D; + C-->D; + ``` + + </details> + MERMAID + + project = create(:project, :public) + issue = create(:issue, project: project, description: description) + + visit project_issue_path(project, issue) + + page.within('.description') do + page.find('summary').click + svg = page.find('svg.mermaid') + + expect(svg[:width].to_i).to be_within(5).of(120) + expect(svg[:height].to_i).to be_within(5).of(220) + end + end end diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb index c6efe1f1896..beed1c07e51 100644 --- a/spec/features/projects/user_uses_shortcuts_spec.rb +++ b/spec/features/projects/user_uses_shortcuts_spec.rb @@ -17,6 +17,59 @@ describe 'User uses shortcuts', :js do wait_for_requests end + context 'disabling shortcuts' do + before do + page.evaluate_script("localStorage.removeItem('shortcutsDisabled')") + end + + it 'can disable shortcuts from help menu' do + open_modal_shortcut_keys + click_toggle_button + close_modal + + open_modal_shortcut_keys + + # modal-shortcuts still in the DOM, but hidden + expect(find('#modal-shortcuts', visible: false)).not_to be_visible + + page.refresh + open_modal_shortcut_keys + + # after reload, shortcuts modal doesn't exist at all until we add it + expect(page).not_to have_selector('#modal-shortcuts') + end + + it 're-enables shortcuts' do + open_modal_shortcut_keys + click_toggle_button + close_modal + + open_modal_from_help_menu + click_toggle_button + close_modal + + open_modal_shortcut_keys + expect(find('#modal-shortcuts')).to be_visible + end + + def open_modal_shortcut_keys + find('body').native.send_key('?') + end + + def open_modal_from_help_menu + find('.header-help-dropdown-toggle').click + find('button', text: 'Keyboard shortcuts').click + end + + def click_toggle_button + find('.js-toggle-shortcuts .gl-toggle').click + end + + def close_modal + find('.modal button[aria-label="Close"]').click + end + end + context 'when navigating to the Project pages' do it 'redirects to the details page' do visit project_issues_path(project) |