Test pass: test_new, test_new_cancel
This commit is contained in:
parent
80b10d108a
commit
8bd102f8de
@ -35,9 +35,8 @@
|
|||||||
<%= ff.number_field :value, {size: 8, step: :any, label: ''} %>
|
<%= ff.number_field :value, {size: 8, step: :any, label: ''} %>
|
||||||
<%= ff.select :unit_id, unit_options, {label: ''} %>
|
<%= ff.select :unit_id, unit_options, {label: ''} %>
|
||||||
<%= ff.hidden_field :_destroy %>
|
<%= ff.hidden_field :_destroy %>
|
||||||
<%= link_to t(".button_delete_readout"), '#',
|
<%= link_to t(".button_delete_readout"), '#', class: 'icon icon-del',
|
||||||
class: 'icon icon-del',
|
style: (@measurement.readouts.many? ? "" : "display:none"),
|
||||||
style: (@measurement.readouts.length > 1 ? "" : "display:none"),
|
|
||||||
onclick: "deleteReadout(); return false;" %>
|
onclick: "deleteReadout(); return false;" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to t(".button_delete_target"), '#', class: 'icon icon-del',
|
<%= link_to t(".button_delete_target"), '#', class: 'icon icon-del',
|
||||||
|
style: (@targets.many? ? "" : "display:none"),
|
||||||
onclick: "deleteTarget(); return false;" %>
|
onclick: "deleteTarget(); return false;" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
@ -40,12 +40,22 @@ class TargetsTest < BodyTrackingSystemTestCase
|
|||||||
assert_selector 'table#targets thead th'
|
assert_selector 'table#targets thead th'
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: rename to test_new; move checking of default values here
|
def test_new
|
||||||
def test_index_show_and_hide_new_target_form
|
|
||||||
visit project_targets_path(@project1)
|
visit project_targets_path(@project1)
|
||||||
assert_no_selector 'form#new-target-form'
|
assert_no_selector 'form#new-target-form'
|
||||||
click_link t('targets.contextual.link_new_target')
|
click_link t('targets.contextual.link_new_target')
|
||||||
assert_selector 'form#new-target-form', count: 1
|
assert_selector 'form#new-target-form', count: 1
|
||||||
|
within 'form#new-target-form' do
|
||||||
|
assert has_select?(t(:field_goal), selected: t('targets.form.binding_goal'))
|
||||||
|
assert has_field?(t(:field_effective_from), with: Date.current.strftime)
|
||||||
|
assert has_no_link?(t('targets.form.button_delete_target'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new_cancel
|
||||||
|
visit project_targets_path(@project1)
|
||||||
|
click_link t('targets.contextual.link_new_target')
|
||||||
|
assert_selector 'form#new-target-form', count: 1
|
||||||
click_on t(:button_cancel)
|
click_on t(:button_cancel)
|
||||||
assert_no_selector 'form#new-target-form'
|
assert_no_selector 'form#new-target-form'
|
||||||
end
|
end
|
||||||
@ -56,8 +66,6 @@ class TargetsTest < BodyTrackingSystemTestCase
|
|||||||
visit project_targets_path(@project1)
|
visit project_targets_path(@project1)
|
||||||
click_link t('targets.contextual.link_new_target')
|
click_link t('targets.contextual.link_new_target')
|
||||||
within 'form#new-target-form' do
|
within 'form#new-target-form' do
|
||||||
assert has_select?(t(:field_goal), selected: t('targets.form.binding_goal'))
|
|
||||||
assert has_field?(t(:field_effective_from), with: Date.current.strftime)
|
|
||||||
within 'p.target' do
|
within 'p.target' do
|
||||||
select quantities(:quantities_energy).name
|
select quantities(:quantities_energy).name
|
||||||
select '=='
|
select '=='
|
||||||
|
Reference in New Issue
Block a user