All files condition.js

33.33% Statements 2/6
0% Branches 0/2
50% Functions 1/2
40% Lines 2/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19      1x 1x                            
// Validate if a field has a given value.
class ValueIs {
  constructor(field, value) {
    this.field = field
    this.value = value
  }
 
  // Return true if the field's value is this.value
  validate(form) {
    let valid = form.fieldValueGet(this.field) == this.value
    if (ddf.debug) console.log('[Condition]', this, '.validate(', form, ') = ', valid)
    return valid
  }
}
 
export {
  ValueIs,
}