champ value return nil if champ is hidden
This commit is contained in:
parent
d1e3a0d29f
commit
72583f846b
2 changed files with 15 additions and 3 deletions
|
@ -22,14 +22,18 @@ class Logic::ChampValue < Logic::Term
|
|||
end
|
||||
|
||||
def compute(champs)
|
||||
targeted_champ = champ(champs)
|
||||
|
||||
return nil if !targeted_champ.visible?
|
||||
|
||||
case type_de_champ.type_champ
|
||||
when MANAGED_TYPE_DE_CHAMP.fetch(:yes_no),
|
||||
MANAGED_TYPE_DE_CHAMP.fetch(:checkbox)
|
||||
champ(champs).true?
|
||||
targeted_champ.true?
|
||||
when MANAGED_TYPE_DE_CHAMP.fetch(:integer_number), MANAGED_TYPE_DE_CHAMP.fetch(:decimal_number)
|
||||
champ(champs).for_api
|
||||
targeted_champ.for_api
|
||||
when MANAGED_TYPE_DE_CHAMP.fetch(:drop_down_list)
|
||||
champ(champs).value
|
||||
targeted_champ.value
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,6 +18,14 @@ describe Logic::ChampValue do
|
|||
|
||||
it { is_expected.to be(false) }
|
||||
end
|
||||
|
||||
context 'with a value not visible' do
|
||||
before do
|
||||
expect(champ).to receive(:visible?).and_return(false)
|
||||
end
|
||||
|
||||
it { is_expected.to be nil }
|
||||
end
|
||||
end
|
||||
|
||||
context 'integer tdc' do
|
||||
|
|
Loading…
Add table
Reference in a new issue