Skip to content

Commit a816b1a

Browse files
committed
adding atom unit test for clearing number field with invalid input
1 parent 1344bb5 commit a816b1a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

javascript/atoms/test/action_test.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
goog.require('goog.Promise');
99
goog.require('goog.Uri');
1010
goog.require('goog.dom');
11+
goog.require('goog.dom.forms');
1112
goog.require('goog.events');
1213
goog.require('goog.events.EventType');
1314
goog.require('goog.testing.jsunit');
@@ -180,6 +181,14 @@
180181
assertEquals('', e.value);
181182
}
182183

184+
function testClearingNumberInputWithInvalidData() {
185+
var e = goog.dom.getElement('numberField');
186+
bot.action.type(e, "e");
187+
bot.action.clear(e);
188+
bot.action.type(e, "3");
189+
assertEquals("3", goog.dom.forms.getValue(e));
190+
}
191+
183192
function testSubmittingANonFormElementShouldResultInAnError() {
184193
assertThrows(goog.partial(bot.action.submit, document.body));
185194
}
@@ -266,6 +275,10 @@
266275
<label for="fileField">File field</label>
267276
<input type="file" id="fileField">
268277
</div>
278+
<div>
279+
<label for="numberField">Number field</label>
280+
<input type="number" id="numberField">
281+
</div>
269282
</form>
270283

271284
<div id="log">

0 commit comments

Comments
 (0)