-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): make config constructor param optional and place defaul…
…t trigger in static property
- Loading branch information
1 parent
39a4e67
commit a52f4c4
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
AureliaValidationConfiguration, | ||
PropertyAccessorParser, | ||
ValidationController, | ||
Validator, | ||
validateTrigger, | ||
} from '../src/aurelia-validation'; | ||
|
||
describe('ValidationController', () => { | ||
it('takes a validator, a PropertyAccessorParser, and optional config', () => { | ||
const validator = {} as any as Validator; | ||
const parser = {} as any as PropertyAccessorParser; | ||
const controller = new ValidationController(validator, parser); | ||
expect(controller.validateTrigger).toBe(AureliaValidationConfiguration.DEFAULT_VALIDATION_TRIGGER); | ||
|
||
const trigger = validateTrigger.changeOrBlur; | ||
const config = new AureliaValidationConfiguration(); | ||
config.defaultValidationTrigger(trigger); | ||
const controllerWithConfig = new ValidationController(validator, parser, config); | ||
expect(controllerWithConfig.validateTrigger).toBe(trigger); | ||
}); | ||
}); |