Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for HMTL5 elements: email, url, number... They are proc…
…essed just like text fields
- Loading branch information
Romain Prieto
committed
Jul 25, 2011
1 parent
2ad8fa8
commit 0093026
Showing
5 changed files
with
100 additions
and
10 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,85 @@ | ||
|
||
describe('html5 inputs', function() { | ||
|
||
it('can read an email field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="email" name="foo" value="bob@test.com" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: 'bob@test.com' }); | ||
}); | ||
|
||
it('can read a URL field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="url" name="foo" value="http://www.google.com/foobar" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: 'http://www.google.com/foobar' }); | ||
}); | ||
|
||
it('can read a telephone field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="tel" name="foo" value="0123456789" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: '0123456789' }); | ||
}); | ||
|
||
it('can read a numeric field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="number" name="foo" value="123" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: '123' }); | ||
}); | ||
|
||
it('can read a range field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="range" name="foo" value="20" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: '20' }); | ||
}); | ||
|
||
it('can read a date field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="date" name="foo" value="30/12/2010" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: '30/12/2010' }); | ||
}); | ||
|
||
it('can read a datetime field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="datetime" name="foo" value="30/12/2010 09:28pm" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: '30/12/2010 09:28pm' }); | ||
}); | ||
|
||
it('can read a search field', function() { | ||
var fixture = $( | ||
'<form>' + | ||
'<input type="search" name="foo" value="keyword" />' + | ||
'</form>' | ||
); | ||
var form = fixture.formality(); | ||
expect(form).toEqual({ foo: 'keyword' }); | ||
}); | ||
|
||
}); | ||
|
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