Skip to content

Commit 9901df0

Browse files
committed
BO bugfix rename election and test this feature
1 parent 3375bd8 commit 9901df0

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

app/assets/javascripts/backoffice/templates/elections/election_item.jst.hamlc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%td
22
%form.rename-election-form
33
%a{href: "#elections/#{@election.id}/candidacies"}= @election.get 'name'
4-
%input{type: 'text'}
4+
%input{type: 'text', name: 'electionName'}
55
%input.btn.success.submit-rename-form{type: 'submit', value: 'Renommer !'}
66
%td
77
%button.btn.primary.display-rename-form Renommer

app/assets/javascripts/backoffice/views/elections/election_item.js.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Backoffice.Views.Elections.ElectionItemView extends Backbone.View
3737

3838
submitRenameForm: (event) ->
3939
event.preventDefault()
40-
electionName = $('input[type=text]').val()
40+
electionName = $('input[name=electionName]', @el).val()
4141
@election.save {}, data: $.param
4242
election:
4343
name: electionName
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Feature: BACKOFFICE Rename election
2+
3+
Background:
4+
Given I am a logged admin
5+
6+
@javascript
7+
Scenario:
8+
Given There is a election with the name "name 1"
9+
And I am on the elections page
10+
When I click on "Renommer" button
11+
And I fill the "electionName" text field with "name 2"
12+
And I click on "Renommer !" button
13+
Then I shoud see "name 2" on the page
14+
And An election with the name "name 2" should be registred

features/step_definitions/elections_steps.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@
2525
Then /^An election with the name "([^"]*)" should be registred$/ do |name|
2626
Election.where(name: name).count.should >= 1
2727
end
28+
29+
Given /^There is a election with the name "([^"]*)"$/ do |election_name|
30+
@election = Factory :election, name: election_name
31+
end

0 commit comments

Comments
 (0)