1
0
Fork 0

FieldVisibilityEventHandler: use new DataValidator API

I updated DataValidator but never updated the caller.  Damnit.  It's
an unfortunate side-effect of dynamic, loosely typed languages and
mitigating it requires what should be boilerplate functional tests (in
this case---functional tests are useful for many other integration
aspects).

* src/event/FieldVisibilityEventHandler.js
  (handle): Use updated DataValidator#clearFailures API, which has
    a different descriptor format.

* test/event/FieldVisibilityEventHandlerTest.js: Update test.
master
Mike Gerwitz 2017-02-09 15:20:23 -05:00
parent 3ea4efb732
commit cc79f8e1f3
2 changed files with 5 additions and 4 deletions

View File

@ -103,7 +103,7 @@ module.exports = Class( 'FieldVisibilityEventHandler' )
}
} )();
this._data_validator.clearFailures( [ field_name ] );
this._data_validator.clearFailures( { [field_name]: indexes } );
indexes.forEach( field_i => action( field_name, field_i ) );
callback();

View File

@ -96,11 +96,12 @@ describe( 'FieldVisibilityEventHandler', () =>
it( 'clears failures on hidden fields', done =>
{
const name = 'foo_bar';
const name = 'foo_bar';
const fail_indexes = [ 0, 3 ];
const hide_data = {
elementName: name,
indexes: [ 0 ],
indexes: fail_indexes,
};
Sut(
@ -108,7 +109,7 @@ describe( 'FieldVisibilityEventHandler', () =>
createStubDataProvider( failures =>
{
expect( failures )
.to.deep.equal( [ name ] )
.to.deep.equal( { [name]: fail_indexes } );
// we don't care about the rest of the processing at this
// point