Commit 15a7f3c6 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch '56424-fix-gl-form-init-tag-editing' into 'master'

Init GLForm instance on form while editing tags

Closes #56424

See merge request gitlab-org/gitlab-ce!24645
parents e055f7d3 eb44dc25
import $ from 'jquery';
import ZenMode from '~/zen_mode';
import GLForm from '~/gl_form';
document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new
new GLForm($('.release-form')); // eslint-disable-line no-new
});
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
= render 'projects/buttons/download', project: @project, ref: tag.name, pipeline: @tags_pipelines[tag.name] = render 'projects/buttons/download', project: @project, ref: tag.name, pipeline: @tags_pipelines[tag.name]
- if can?(current_user, :push_code, @project) - if can?(current_user, :push_code, @project)
= link_to edit_project_tag_release_path(@project, tag.name), class: 'btn has-tooltip', title: s_('TagsPage|Edit release notes'), data: { container: "body" } do = link_to edit_project_tag_release_path(@project, tag.name), class: 'btn btn-edit has-tooltip', title: s_('TagsPage|Edit release notes'), data: { container: "body" } do
= icon("pencil") = icon("pencil")
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
.nav-controls.controls-flex .nav-controls.controls-flex
- if can?(current_user, :push_code, @project) - if can?(current_user, :push_code, @project)
= link_to edit_project_tag_release_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Edit release notes') do = link_to edit_project_tag_release_path(@project, @tag.name), class: 'btn btn-edit controls-item has-tooltip', title: s_('TagsPage|Edit release notes') do
= icon("pencil") = icon("pencil")
= link_to project_tree_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Browse files') do = link_to project_tree_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Browse files') do
= icon('files-o') = icon('files-o')
......
---
title: Fix form functionality for edit tag page
merge_request: 24645
author:
type: fixed
# frozen_string_literal: true
require 'rails_helper'
describe 'Project > Tags', :js do
include DropzoneHelper
let(:user) { create(:user) }
let(:role) { :developer }
let(:project) { create(:project, :repository) }
before do
sign_in(user)
project.add_role(user, role)
end
describe 'when opening project tags' do
before do
visit project_tags_path(project)
end
context 'page with tags list' do
it 'shows tag name' do
page.within first('.tags > .content-list > li') do
expect(page.find('.row-main-content')).to have_content 'v1.1.0 Version 1.1.0'
end
end
it 'shows tag edit button' do
page.within first('.tags > .content-list > li') do
edit_btn = page.find('.row-fixed-content.controls a.btn-edit')
expect(edit_btn['href']).to have_content '/tags/v1.1.0/release/edit'
end
end
end
context 'edit tag release notes' do
before do
find('.tags > .content-list > li:first-child .row-fixed-content.controls a.btn-edit').click
end
it 'shows tag name header' do
page.within('.content') do
expect(page.find('.sub-header-block')).to have_content 'Release notes for tag v1.1.0'
end
end
it 'shows release notes form' do
page.within('.content') do
expect(page).to have_selector('form.release-form')
end
end
it 'toolbar buttons on release notes form are functional' do
page.within('.content form.release-form') do
note_textarea = page.find('.js-gfm-input')
# Click on Bold button
page.find('.md-header-toolbar button.toolbar-btn:first-child').click
expect(note_textarea.value).to eq('****')
end
end
it 'release notes form shows "Attach a file" button', :js do
page.within('.content form.release-form') do
expect(page).to have_button('Attach a file')
expect(page).not_to have_selector('.uploading-progress-container', visible: true)
end
end
it 'shows "Attaching a file" message on uploading 1 file', :js do
slow_requests do
dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -')
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment