Commit graph

89 commits

Author SHA1 Message Date
WPT Sync Bot
e9bdf87a27 Update web-platform-tests to revision 155daf0c385420faf208b8bd5e319e244ec7f9cc 2018-05-28 11:37:21 -04:00
WPT Sync Bot
6b4094e2a4 Update web-platform-tests to revision 314de955a5102650136404f6439f22f8d838e0f4 2018-05-23 22:49:09 -04:00
WPT Sync Bot
24183668c4 Update web-platform-tests to revision 81962ac8802223d038b188b6f9cb88a0a9c5beee 2018-05-18 23:55:46 -04:00
WPT Sync Bot
816185f094 Update web-platform-tests to revision ea14651f262003177d0ba5819bd2806a1327b12a 2018-04-30 23:01:48 -04:00
WPT Sync Bot
2b35c55ac7 Update web-platform-tests to revision d04a8fc02b85bd32799691759c8c05ead07cd939 2018-03-23 22:48:00 -04:00
WPT Sync Bot
db5631a086 Update web-platform-tests to revision e87f38097902e16348d4e17f4fe3bc2d0112bff1 2018-03-17 23:34:27 -04:00
WPT Sync Bot
f3533538ea Update web-platform-tests to revision 9817f7f027fe1e92cc2fce31d6002c4d669918e8 2018-03-09 08:47:07 -05:00
WPT Sync Bot
8a6476740e Update web-platform-tests to revision 8fed98324bc133df221d778c62cbff210d43b0ce 2018-02-19 21:42:17 -05:00
paavininanda
06f0ad1be7 Adding tests with DRY coding technique 2018-02-15 01:48:48 +05:30
paavininanda
b2c1f89b93 Correct default Selectionstart and SelectionEnd 2018-02-10 17:46:29 +05:30
WPT Sync Bot
e0fb3fc586 Update web-platform-tests to revision d6d3f7267e817925131675bfc203c62bda96febe 2018-02-07 23:14:20 -05:00
WPT Sync Bot
cd5bf022bd Update web-platform-tests to revision 68a256f49be380ca4add535ce8ece9de28820e6b 2018-02-04 21:05:56 -05:00
Jon Leighton
a8b64aca2a Steps 7-9 of the input type change algorithm
Spec: https://html.spec.whatwg.org/multipage/input.html#input-type-change

In short, this resets the selection to the start of the field when the
type has changed from one which doesn't support the selection API to one
that does.

I couldn't see an existing WPT test covering this.
2018-01-26 20:12:38 +01:00
Jon Leighton
02883a6f54 Fix selection{Start,End} when selectionDirection is "backward"
Per the spec, selectionStart and selectionEnd should return the same
values regardless of the selectionDirection. (That is, selectionStart is
always less than or equal to selectionEnd; the direction then implies
which of selectionStart or selectionEnd is the cursor position.)

There was no explicit WPT test for this, so I added one.

This bug was initially quite hard to wrap my head around, and I think
part of the problem is the code in TextInput. Therefore, in the process
of fixing it I have refactored the implementation of TextInput:

* Rename selection_begin to selection_origin. This value doesn't
  necessarily correspond directly to the selectionStart DOM value - in
  the case of a backward selection, it corresponds to selectionEnd.
  I feel that "origin" doesn't imply a specific ordering as strongly as
  "begin" (or "start" for that matter) does.

* In various other cases where "begin" is used as a synonym for "start",
  just use "start" for consistency.

* Implement selection_start() and selection_end() methods (and their
  _offset() variants) which directly correspond to their DOM
  equivalents.

* Rename other related methods to make them less wordy and more
  consistent / intention-revealing.

* Add assertions to assert_ok_selection() to ensure that our assumptions
  about the ordering of selection_origin and edit_point are met. This
  then revealed a bug in adjust_selection_for_horizontal_change() where
  the value of selection_direction was not maintained correctly (causing
  a unit test failure when the new assertion failed).
2018-01-26 19:50:50 +01:00
tigercosmos
b29230bd76 implement range input sanitization 2018-01-17 16:27:21 +08:00
Josh Matthews
2b6f573eb5 Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317 2018-01-09 12:52:27 -05:00
tigercosmos
b43424111e implement valid Date time Local input 2018-01-07 18:31:32 +08:00
tigercosmos
54c6028033 implement valid week string 2017-12-17 16:57:01 +08:00
Jon Leighton
71a013dd50 Handle cases where selection API doesn't apply
The selection API only applies to certain <input> types:

https://html.spec.whatwg.org/multipage/#do-not-apply

This commit ensures that we handle that correctly.

Some notes:

1. TextControl::set_dom_selection_direction now calls
   set_selection_range(), which means that setting selectionDirection will
   now fire a selection event, as it should per the spec.

2. There is a test for the firing of the select event in
   tests/wpt/web-platform-tests/html/semantics/forms/textfieldselection/select-event.html,
   however the test did not run due to this syntax error:

   (pid:26017) "ERROR:script::dom::bindings::error: Error at http://web-platform.test:8000/html/semantics/forms/textfieldselection/select-event.html:50:11 missing = in const declaration"

   This happens due to the us of the "for (const foo of ...)" construct.
   Per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
   this should actually work, so it's somewhat unsatisfying to have to
   change the test.

4. If an <input>'s type is unset, it defaults to a text, and the
   selection API applies. Also, if an <input>'s type is set to an
   invalid value, it defaults to a text too. I've expanded the tests
   to account for this second case.
2017-12-08 21:07:05 +01:00
tigercosmos
927fd1d044 implement "Date type inputs", "Month type inputs" 2017-12-05 09:44:51 +08:00
Simon Wörner
a999239f28 Added time input sanitization:
- Implemented is_valid_time_string for DOMString.
- Use is_valid_time_string for sanitize_value with time input.
- Improved input type change test
2017-12-04 11:21:28 +01:00
Jon Leighton
a7a5babb3a Move selection to end when textarea value is assigned
Issue #19171
2017-11-25 16:35:56 +01:00
Bastien Orivel
05c4e08d58 Add a sanitize_value implementation for the color input
I had to change the test a little bit to avoid some failures due to
color and text both having a sanitizedValue which was making the test
use the first assertion instead of the second one in some cases.

The sanitize_value implementation is pretty simple, we iterate over the
content and checks that the content is 7 characters long, that the first
character is a `#` and then that all the following characters are
hexadecimal. If all those requirements are met, we lowercase the
content, otherwise we put `#000000` in it.
2017-11-22 22:36:21 +01:00
Jon Leighton
f290cacccd Refactor selection-start-end test
Move assertions about the initial value of selection{Start,End} to their
own tests. This ensures that when one of these assertions fails, it
doesn't prevent other tests from being defined. Thus we have a clearer
view of which tests are passing or failing, since all tests get defined
regardless of which assertions fail.
2017-11-18 22:33:00 +01:00
Josh Matthews
c227604a2c Update web-platform-tests to revision 44702f2bc8ea98bc32b5b244f2fe63c6ce66d49d 2017-11-15 12:47:30 -05:00
Keith Yeung
8203605c04 Implement value sanitization on HTMLInputElement 2017-11-09 16:34:14 -08:00
Josh Matthews
1f531f66ea Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326 2017-10-12 12:36:21 -04:00
Josh Matthews
578498ba24 Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d 2017-10-05 00:42:13 +02:00
Josh Matthews
665817d2a6 Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444 2017-04-22 14:17:10 +02:00
Mukilan Thiyagarajan
38a61712e4 Implement the form owner concept 2017-03-15 16:39:55 +01:00
Ms2ger
4fadf9b0b6 Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534
Fixes #15648.
2017-02-20 13:52:41 +01:00
Corey Farwell
d4ad51bfde Implement selectedIndex IDL attribute on HTMLOptionsCollection. 2017-02-12 23:48:52 -05:00
Ms2ger
296fa2512b Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
2017-02-06 22:38:29 +01:00
Ms2ger
d6ba94ca28 Update web-platform-tests to revision 3137d1d2d7757366a69f8a449b458b5057e0e81e 2016-12-28 11:34:21 +01:00
Corey Farwell
51f9671db2 Implement "list of options" concept on HTMLSelectElement.
Fixes https://github.com/servo/servo/issues/13763.
2016-12-01 00:10:16 -05:00
Ms2ger
ccdb0a3458 Update web-platform-tests to revision e8bfc205e36ad699601212cd50083870bad9a75d 2016-11-15 09:35:34 +01:00
Emilio Cobos Álvarez
58bd039b50
mark submit-entity-body.html as needing a long timeout.
After discussion with jdm.
2016-11-14 21:24:20 +01:00
Ms2ger
e0da3a4c1b Remove trailing whitespace from a test.
Cherry-pick of <f23222137d>.
2016-10-31 15:00:47 +01:00
Corey Farwell
bec5bf49bd Implement selectedIndex property on <select>. 2016-10-24 14:14:49 -04:00
Corey Farwell
957e1d8e7a Make 'reset-form.html' test more granular. 2016-10-20 00:02:53 -04:00
Jake Goldsborough
ce249d9384 adding macro to return string or url,
using that macro with the form action,
making the form submit process use base url,
adding tests.
2016-09-27 09:33:11 -07:00
Alexandrov Sergey
2173545cdb fix existing test expectations and add new tests for HTMLOptionsCollection 2016-09-26 21:54:01 +03:00
Ms2ger
3b4f0ec0bb Update web-platform-tests to revision 3b3585e368841b77caea8576fa56cef91c3fbdf0 2016-09-26 13:24:06 +02:00
Taryn Hill
2cb5adf6c6 Implement minlength for text inputs 2016-09-21 07:54:39 -05:00
Ms2ger
079092dfea Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0 2016-09-09 16:17:14 +02:00
Alexandrov Sergey
e4006fa9dd add HTMLOptionElement form attribute test 2016-08-30 17:30:06 +03:00
Alan Jeffrey
7ed8408f12 Added checks that selection is valid, and fix set_selection_range. 2016-06-29 07:24:19 -05:00
mrmiywj
4bb88432b2 indexed getter of form elements 2016-06-14 21:40:32 -07:00
Ms2ger
7c4281f3da Update web-platform-tests to revision bda2059150dca8ab47f088b4cc619fcdc1f262fa 2016-05-30 14:04:50 +02:00
Manish Goregaokar
90d72c5de0
Add tests for submit buttons with values 2016-05-23 15:26:10 +05:30