This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(inlineinput): float value validation for user input (#2816)
* Float field validation in inlineinput * Float validation for inlineinput * Fix-Float validation for inlineinput * fix(inlineinput): Float value validation for user input * fix(inlineinput): Float value validation for user input * fix(inlineinput): Float value validation for user input
- Loading branch information
1 parent
ca2af97
commit ca3a7d5
Showing
2 changed files
with
51 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { async } from '@angular/core/testing'; | ||
import { InlineInputComponent } from './inlineinput.component'; | ||
|
||
describe('Unit Test :: Inline Input Float value', () => { | ||
let comp = new InlineInputComponent(); | ||
beforeEach(async(() => { | ||
comp.type = 'float'; | ||
})); | ||
|
||
it('Should return true for input 2234.523 in float range', () => { | ||
expect(comp.validateValue('2234.523')).toBe(true); | ||
}); | ||
|
||
it('Should return true for input 1.2 in float range', () => { | ||
expect(comp.validateValue('1.2')).toBe(true); | ||
}); | ||
|
||
it('Should return true for input 223456.334 in float range', () => { | ||
expect(comp.validateValue('223456.334')).toBe(true); | ||
}); | ||
|
||
it('Should return true for input 45 in float range', () => { | ||
expect(comp.validateValue('45')).toBe(true); | ||
}); | ||
|
||
it('Should return false for input -34567812322.523 outside float range', () => { | ||
expect(comp.validateValue('-34567812322.523')).toBe(false); | ||
}); | ||
|
||
it('Should return false for input 345678123225.23678 outside float range', () => { | ||
expect(comp.validateValue('345678123225.23678')).toBe(false); | ||
}); | ||
|
||
it('Should return false for input stringtest outside float range', () => { | ||
expect(comp.validateValue('stringtest')).toBe(false); | ||
}); | ||
|
||
it('Should return false for input 11111111111111111.51 outside float range', () => { | ||
expect(comp.validateValue('11111111111111111.51')).toBe(false); | ||
}); | ||
}); |