Add feature spec for Release page MVC
This commit is contained in:
parent
fa5c4ef264
commit
89343b26c3
4 changed files with 62 additions and 1 deletions
|
@ -98,7 +98,7 @@ export default {
|
||||||
<li v-for="link in assets.links" :key="link.name" class="append-bottom-8">
|
<li v-for="link in assets.links" :key="link.name" class="append-bottom-8">
|
||||||
<gl-link v-gl-tooltip.bottom :title="__('Download asset')" :href="link.url">
|
<gl-link v-gl-tooltip.bottom :title="__('Download asset')" :href="link.url">
|
||||||
<icon name="package" class="align-middle append-right-4 align-text-bottom" />
|
<icon name="package" class="align-middle append-right-4 align-text-bottom" />
|
||||||
{{ link.name }}
|
{{ link.name }} <span v-if="link.external"> {{ __('(external source)') }}</span>
|
||||||
</gl-link>
|
</gl-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -185,6 +185,9 @@ msgstr ""
|
||||||
msgid "%{user_name} profile page"
|
msgid "%{user_name} profile page"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "(external source)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "+ %{count} more"
|
msgid "+ %{count} more"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
46
spec/features/projects/releases/user_views_releases_spec.rb
Normal file
46
spec/features/projects/releases/user_views_releases_spec.rb
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'User views releases', :js do
|
||||||
|
let!(:project) { create(:project, :repository) }
|
||||||
|
let!(:release) { create(:release, project: project ) }
|
||||||
|
let!(:user) { create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
project.add_maintainer(user)
|
||||||
|
|
||||||
|
gitlab_sign_in(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sees the release' do
|
||||||
|
visit project_releases_path(project)
|
||||||
|
|
||||||
|
expect(page).to have_content(release.name)
|
||||||
|
expect(page).to have_content(release.tag)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when there is a link as an asset' do
|
||||||
|
let!(:release_link) { create(:release_link, release: release, url: url ) }
|
||||||
|
let(:url) { "#{project.web_url}/-/jobs/1/artifacts/download" }
|
||||||
|
|
||||||
|
it 'sees the link' do
|
||||||
|
visit project_releases_path(project)
|
||||||
|
|
||||||
|
page.within('.js-assets-list') do
|
||||||
|
expect(page).to have_link release_link.name, href: release_link.url
|
||||||
|
expect(page).not_to have_content('(external source)')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when url points to external resource' do
|
||||||
|
let(:url) { 'http://google.com/download' }
|
||||||
|
|
||||||
|
it 'sees that the link is external resource' do
|
||||||
|
visit project_releases_path(project)
|
||||||
|
|
||||||
|
page.within('.js-assets-list') do
|
||||||
|
expect(page).to have_content('(external source)')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -137,4 +137,16 @@ describe('Release block', () => {
|
||||||
it('renders author avatar', () => {
|
it('renders author avatar', () => {
|
||||||
expect(vm.$el.querySelector('.user-avatar-link')).not.toBeNull();
|
expect(vm.$el.querySelector('.user-avatar-link')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('external label', () => {
|
||||||
|
it('renders external label when link is external', () => {
|
||||||
|
expect(vm.$el.querySelector('.js-assets-list li a').textContent).toContain('external source');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not render external label when link is not external', () => {
|
||||||
|
expect(vm.$el.querySelector('.js-assets-list li:nth-child(2) a').textContent).not.toContain(
|
||||||
|
'external source',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue