Merge pull request #981 from sgmap/fix_980
[Fix# 980] Engagement checkbox should be checked sometimes
This commit is contained in:
commit
0ae4536369
2 changed files with 21 additions and 1 deletions
|
@ -1,2 +1,2 @@
|
|||
%input{ type: 'hidden', name: "champs['#{champ.id}']", id: "champs_#{champ.id}", value: '' }
|
||||
%input{ type: 'checkbox', style: 'margin-left: 15px;', name: "champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on') }
|
||||
%input{ type: 'checkbox', style: 'margin-left: 15px;', name: "champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.object.value == 'on') }
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/description/champs/engagement.html.haml', type: :view do
|
||||
let(:type_champ) { create(:type_de_champ_public, type_champ: :engagement) }
|
||||
|
||||
subject { render 'users/description/champs/engagement.html.haml', champ: champ }
|
||||
|
||||
context "when the value is on" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: "on").decorate }
|
||||
|
||||
it { is_expected.to have_selector("input[type='checkbox'][checked]") }
|
||||
end
|
||||
|
||||
context "when the value is nil" do
|
||||
let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil).decorate }
|
||||
|
||||
it { is_expected.to have_selector("input[type='checkbox']") }
|
||||
it { is_expected.not_to have_selector("input[type='checkbox'][checked]") }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue