-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ValidationMessageProvider): include displayName arg
fixes #328 Now the getDisplayName method will be called for all properties, even those that have a display name already configured via the fluent rule API's displayName method.
- Loading branch information
Showing
3 changed files
with
33 additions
and
5 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,24 @@ | ||
import { Container } from 'aurelia-dependency-injection'; | ||
import { BindingLanguage } from 'aurelia-templating'; | ||
import { TemplatingBindingLanguage } from 'aurelia-templating-binding'; | ||
import { ValidationMessageProvider } from '../src/aurelia-validation'; | ||
|
||
describe('ValidationMessageProvider', () => { | ||
let messageProvider: ValidationMessageProvider; | ||
|
||
beforeAll(() => { | ||
const container = new Container(); | ||
container.registerInstance(BindingLanguage, container.get(TemplatingBindingLanguage)); | ||
messageProvider = container.get(ValidationMessageProvider); | ||
}); | ||
|
||
it('computes display name', () => { | ||
expect(messageProvider.getDisplayName('foo', null)).toBe('Foo'); | ||
expect(messageProvider.getDisplayName('fooBar', null)).toBe('Foo Bar'); | ||
expect(messageProvider.getDisplayName('foo bar', null)).toBe('Foo bar'); | ||
expect(messageProvider.getDisplayName('foo', undefined)).toBe('Foo'); | ||
expect(messageProvider.getDisplayName('fooBar', undefined)).toBe('Foo Bar'); | ||
expect(messageProvider.getDisplayName('foo bar', undefined)).toBe('Foo bar'); | ||
expect(messageProvider.getDisplayName('foo', 'hello')).toBe('hello'); | ||
}); | ||
}); |