本文整理匯總了TypeScript中forms/validation/validators/dateFutureConstraint.DateFutureConstraint類的典型用法代碼示例。如果您正苦於以下問題:TypeScript DateFutureConstraint類的具體用法?TypeScript DateFutureConstraint怎麽用?TypeScript DateFutureConstraint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DateFutureConstraint類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: describe
describe('DateFutureConstraint', () => {
const constraint: DateFutureConstraint = new DateFutureConstraint()
describe('validate', () => {
describe('should return true when ', () => {
it('given a date is undefined', () => {
expect(constraint.validate(undefined)).to.equal(true)
})
it('given a valid date in the future', () => {
const inFuture = MomentFactory.currentDate().add(10, 'years')
expect(constraint.validate(new LocalDate(inFuture.year(), 1, 1), validationArgs)).to.equal(true)
})
})
describe('should return false when ', () => {
it('given an invalid structure', () => {
expect(constraint.validate({ a: 1, b: 1, c: 2000 }, validationArgs)).to.equal(false)
})
it('given today date', () => {
const now = MomentFactory.currentDate()
expect(constraint.validate(new LocalDate(now.year(), now.month() + 1, now.date()), validationArgs)).to.equal(false)
})
it('given a date in the past', () => {
const inPast = MomentFactory.currentDate().subtract(10, 'years')
expect(constraint.validate(new LocalDate(inPast.year(), 8, 8), validationArgs)).to.equal(false)
})
})
})
})
示例2: it
it('given a date in the past', () => {
const inPast = MomentFactory.currentDate().subtract(10, 'years')
expect(constraint.validate(new LocalDate(inPast.year(), 8, 8), validationArgs)).to.equal(false)
})