Commit 1bb9aeb565fca50304881e36488b202455bdddd2

Authored by Dmitriy Zaporozhets
1 parent 7c6a58a7

Fix specs. Fix note form reset after submit

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/javascripts/notes.js.coffee
@@ -203,8 +203,7 @@ class Notes @@ -203,8 +203,7 @@ class Notes
203 form.find(".js-errors").remove() 203 form.find(".js-errors").remove()
204 204
205 # reset text and preview 205 # reset text and preview
206 - previewContainer = form.find(".note-edit-and-preview")  
207 - previewContainer.removeClass "on" if previewContainer.is(".on") 206 + form.find(".js-note-write-button").click()
208 form.find(".js-note-text").val("").trigger "input" 207 form.find(".js-note-text").val("").trigger "input"
209 208
210 ### 209 ###
@@ -254,7 +253,7 @@ class Notes @@ -254,7 +253,7 @@ class Notes
254 form.removeClass "js-new-note-form" 253 form.removeClass "js-new-note-form"
255 254
256 # setup preview buttons 255 # setup preview buttons
257 - form.find(".js-note-edit-button, .js-note-preview-button").tooltip placement: "left" 256 + form.find(".js-note-write-button, .js-note-preview-button").tooltip placement: "left"
258 previewButton = form.find(".js-note-preview-button") 257 previewButton = form.find(".js-note-preview-button")
259 form.find(".js-note-text").on "input", -> 258 form.find(".js-note-text").on "input", ->
260 if $(this).val().trim() isnt "" 259 if $(this).val().trim() isnt ""
spec/features/notes_on_merge_requests_spec.rb
@@ -44,7 +44,7 @@ describe &quot;On a merge request&quot;, js: true, feature: true do @@ -44,7 +44,7 @@ describe &quot;On a merge request&quot;, js: true, feature: true do
44 it 'should have text and visible edit button' do 44 it 'should have text and visible edit button' do
45 within(".js-main-target-form") { should have_css(".js-note-preview", text: "This is awesome", visible: true) } 45 within(".js-main-target-form") { should have_css(".js-note-preview", text: "This is awesome", visible: true) }
46 within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } 46 within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) }
47 - within(".js-main-target-form") { should have_css(".js-note-edit-button", visible: true) } 47 + within(".js-main-target-form") { should have_css(".js-note-write-button", visible: true) }
48 end 48 end
49 end 49 end
50 end 50 end
spec/features/security/project/internal_access_spec.rb
@@ -190,17 +190,6 @@ describe &quot;Internal Project Access&quot;, feature: true do @@ -190,17 +190,6 @@ describe &quot;Internal Project Access&quot;, feature: true do
190 it { should be_denied_for :visitor } 190 it { should be_denied_for :visitor }
191 end 191 end
192 192
193 - describe "GET /:project_path/branches/recent" do  
194 - subject { recent_project_branches_path(project) }  
195 -  
196 - it { should be_allowed_for master }  
197 - it { should be_allowed_for reporter }  
198 - it { should be_allowed_for :admin }  
199 - it { should be_allowed_for guest }  
200 - it { should be_allowed_for :user }  
201 - it { should be_denied_for :visitor }  
202 - end  
203 -  
204 describe "GET /:project_path/branches" do 193 describe "GET /:project_path/branches" do
205 subject { project_branches_path(project) } 194 subject { project_branches_path(project) }
206 195
spec/features/security/project/private_access_spec.rb
@@ -168,17 +168,6 @@ describe &quot;Private Project Access&quot;, feature: true do @@ -168,17 +168,6 @@ describe &quot;Private Project Access&quot;, feature: true do
168 it { should be_denied_for :visitor } 168 it { should be_denied_for :visitor }
169 end 169 end
170 170
171 - describe "GET /:project_path/branches/recent" do  
172 - subject { recent_project_branches_path(project) }  
173 -  
174 - it { should be_allowed_for master }  
175 - it { should be_allowed_for reporter }  
176 - it { should be_allowed_for :admin }  
177 - it { should be_denied_for guest }  
178 - it { should be_denied_for :user }  
179 - it { should be_denied_for :visitor }  
180 - end  
181 -  
182 describe "GET /:project_path/branches" do 171 describe "GET /:project_path/branches" do
183 subject { project_branches_path(project) } 172 subject { project_branches_path(project) }
184 173
spec/features/security/project/public_access_spec.rb
@@ -195,17 +195,6 @@ describe &quot;Public Project Access&quot;, feature: true do @@ -195,17 +195,6 @@ describe &quot;Public Project Access&quot;, feature: true do
195 it { should be_denied_for :visitor } 195 it { should be_denied_for :visitor }
196 end 196 end
197 197
198 - describe "GET /:project_path/branches/recent" do  
199 - subject { recent_project_branches_path(project) }  
200 -  
201 - it { should be_allowed_for master }  
202 - it { should be_allowed_for reporter }  
203 - it { should be_allowed_for :admin }  
204 - it { should be_allowed_for guest }  
205 - it { should be_allowed_for :user }  
206 - it { should be_allowed_for :visitor }  
207 - end  
208 -  
209 describe "GET /:project_path/branches" do 198 describe "GET /:project_path/branches" do
210 subject { project_branches_path(project) } 199 subject { project_branches_path(project) }
211 200