Skip to content

Commit

Permalink
Allow to enter zero concentration in boxes creation (#1908)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroradusky authored Feb 9, 2023
1 parent f879532 commit 8b12613
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/box_batches_form.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ var BoxBatchForm = React.createClass({
},

isValidConcentration: function (c) {
return (parseInt(c.replicate, 10) > 0 && parseFloat(c.concentration, 10) > 0);
return (parseInt(c.replicate, 10) > 0 && parseFloat(c.concentration, 10) >= 0);
},

hideForm: function (event) {
Expand Down
10 changes: 3 additions & 7 deletions app/assets/stylesheets/_batches.scss
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,9 @@
display: flex;
align-items: center;
margin-left: auto;

.icon-check {
width: 24px;
height: 24px;
margin-left: 10px;
background-size: 100%;
cursor: pointer;

>input{
width: 80px;
}
}

Expand Down
5 changes: 4 additions & 1 deletion spec/features/boxes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@

# validates concentration field:
field = batch_form.concentration_fields[0]
field.set(0)
field.set(-1)
expect(batch_form.ok.disabled?).to be(true)

field.set(0)
expect(batch_form.ok.disabled?).to be(false)

field.set(2)
expect(batch_form.ok.disabled?).to be(false)
end
Expand Down

0 comments on commit 8b12613

Please sign in to comment.