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
fix(inlineinput): float value validation for user input #2816
Merged
joshuawilson
merged 8 commits into
fabric8-ui:master
from
abhinandan13jan:fix-float-input
Dec 13, 2018
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6b6f31c
Float field validation in inlineinput
15081e1
Float validation for inlineinput
f1cdf66
Fix-Float validation for inlineinput
3c919ae
fix(inlineinput): Float value validation for user input
c030583
fix(inlineinput): Float value validation for user input
9623a2c
fix(inlineinput): Float value validation for user input
471b887
Merge branch 'master' into fix-float-input
joshuawilson 929a6ac
Merge branch 'master' into fix-float-input
joshuawilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abhinandan13jan This method is still failing because
value
is of typestring
.value
needs to be parsed first for this to work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahil143 I was trying not to alter any preexisting functionalities. Now, I've added a .focus() method for the validation failure case. Can you please check again if it looks ok now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshuawilson I've updated using sematic release format