diff options
author | Dennis Tang <dennis@dennistang.net> | 2018-09-06 07:27:39 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-09-06 07:27:39 +0000 |
commit | ec4ad656f03f6a648867cc70b3e076768615919c (patch) | |
tree | 1fbac0db493df06095acebaf32752682785f2577 /spec/features/projects_spec.rb | |
parent | d32cec18cac7042ee7a00426ce79f048b3add697 (diff) | |
download | gitlab-ce-ec4ad656f03f6a648867cc70b3e076768615919c.tar.gz |
Resolve "Improve project overview UI"
Diffstat (limited to 'spec/features/projects_spec.rb')
-rw-r--r-- | spec/features/projects_spec.rb | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 56ed0c936a6..22e3a99072f 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe 'Project' do include ProjectForksHelper + include MobileHelpers describe 'creating from template' do let(:user) { create(:user) } @@ -54,25 +55,72 @@ describe 'Project' do it 'parses Markdown' do project.update_attribute(:description, 'This is **my** project') visit path - expect(page).to have_css('.project-home-desc > p > strong') + expect(page).to have_css('.project-description > .project-description-markdown > p > strong') end it 'passes through html-pipeline' do project.update_attribute(:description, 'This project is the :poop:') visit path - expect(page).to have_css('.project-home-desc > p > gl-emoji') + expect(page).to have_css('.project-description > .project-description-markdown > p > gl-emoji') end it 'sanitizes unwanted tags' do project.update_attribute(:description, "```\ncode\n```") visit path - expect(page).not_to have_css('.project-home-desc code') + expect(page).not_to have_css('.project-description code') end it 'permits `rel` attribute on links' do project.update_attribute(:description, 'https://google.com/') visit path - expect(page).to have_css('.project-home-desc a[rel]') + expect(page).to have_css('.project-description a[rel]') + end + + context 'read more', :js do + let(:read_more_selector) { '.read-more-container' } + let(:read_more_trigger_selector) { '.project-home-desc .js-read-more-trigger' } + + it 'does not display "read more" link on desktop breakpoint' do + project.update_attribute(:description, 'This is **my** project') + visit path + + expect(find(read_more_trigger_selector, visible: false)).not_to be_visible + end + + it 'displays "read more" link on mobile breakpoint' do + project.update_attribute(:description, 'This is **my** project') + visit path + resize_screen_xs + + find(read_more_trigger_selector).click + + expect(page).to have_css('.project-description .is-expanded') + end + end + end + + describe 'copy clone URL to clipboard', :js do + let(:project) { create(:project, :repository) } + let(:path) { project_path(project) } + + before do + sign_in(create(:admin)) + visit path + end + + context 'desktop component' do + it 'shows on md and larger breakpoints' do + expect(find('.git-clone-holder')).to be_visible + expect(find('.mobile-git-clone', visible: false)).not_to be_visible + end + end + + context 'mobile component' do + it 'shows mobile component on sm and smaller breakpoints' do + resize_screen_xs + expect(find('.mobile-git-clone')).to be_visible + expect(find('.git-clone-holder', visible: false)).not_to be_visible + end end end |