From 94340c1c014a4f312535bbe4398f086ecce404ab Mon Sep 17 00:00:00 2001 From: jvelilla Date: Thu, 28 May 2015 09:19:21 -0300 Subject: [PATCH] Updated html5 classes based on review --- .../server/wsf_html/form/wsf_form_date_input.e | 2 +- .../wsf_html/form/wsf_form_datetime_input.e | 2 +- .../form/wsf_form_datetime_local_input.e | 2 +- ...e => wsf_form_field_with_numeric_attribute.e} | 13 +++++++------ .../server/wsf_html/form/wsf_form_image_input.e | 2 +- .../wsf_html/form/wsf_form_input_with_html5.e | 16 ++++++++-------- .../server/wsf_html/form/wsf_form_month_input.e | 2 +- .../wsf_html/form}/wsf_form_number_input.e | 2 +- .../server/wsf_html/form}/wsf_form_range_input.e | 2 +- .../server/wsf_html/form/wsf_form_submit_input.e | 2 +- .../server/wsf_html/form/wsf_form_time_input.e | 2 +- .../server/wsf_html/form/wsf_form_week_input.e | 2 +- ...ons.e => wsf_form_with_alternative_actions.e} | 5 +++-- tests/server/wsf_html/application.e | 6 +++--- .../wsf_html/wsf_form_input_html5_test_set.e | 12 ++++++------ 15 files changed, 37 insertions(+), 35 deletions(-) rename library/server/wsf_html/form/{wsf_form_with_numeric_attribute.e => wsf_form_field_with_numeric_attribute.e} (81%) rename {tests/server/wsf_html => library/server/wsf_html/form}/wsf_form_number_input.e (94%) rename {tests/server/wsf_html => library/server/wsf_html/form}/wsf_form_range_input.e (93%) rename library/server/wsf_html/form/{wsf_form_with_atlernative_actions.e => wsf_form_with_alternative_actions.e} (96%) diff --git a/library/server/wsf_html/form/wsf_form_date_input.e b/library/server/wsf_html/form/wsf_form_date_input.e index 309721b5..e825f842 100644 --- a/library/server/wsf_html/form/wsf_form_date_input.e +++ b/library/server/wsf_html/form/wsf_form_date_input.e @@ -16,7 +16,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_datetime_input.e b/library/server/wsf_html/form/wsf_form_datetime_input.e index 5c7cf6e2..c7a25fe9 100644 --- a/library/server/wsf_html/form/wsf_form_datetime_input.e +++ b/library/server/wsf_html/form/wsf_form_datetime_input.e @@ -19,7 +19,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_datetime_local_input.e b/library/server/wsf_html/form/wsf_form_datetime_local_input.e index a64d080a..b3317a24 100644 --- a/library/server/wsf_html/form/wsf_form_datetime_local_input.e +++ b/library/server/wsf_html/form/wsf_form_datetime_local_input.e @@ -16,7 +16,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_with_numeric_attribute.e b/library/server/wsf_html/form/wsf_form_field_with_numeric_attribute.e similarity index 81% rename from library/server/wsf_html/form/wsf_form_with_numeric_attribute.e rename to library/server/wsf_html/form/wsf_form_field_with_numeric_attribute.e index 62c70351..f51cc6c3 100644 --- a/library/server/wsf_html/form/wsf_form_with_numeric_attribute.e +++ b/library/server/wsf_html/form/wsf_form_field_with_numeric_attribute.e @@ -5,17 +5,18 @@ note ]" date: "$Date$" revision: "$Revision$" + EIS: "name=numeric attributes", "src=https://html.spec.whatwg.org/multipage/forms.html#common-input-element-attributes" class - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE feature -- Access min: detachable READABLE_STRING_32 - -- Represent the minimun value the field will accept + -- minimun value accepted by Current field. max: detachable READABLE_STRING_32 - -- Represent the maximun value the field will accept. + -- maximun value accepted by Current field. step: detachable READABLE_STRING_32 -- step is the increment that the value should adjust up or down, with the default step value being 1. @@ -79,21 +80,21 @@ feature {NONE} -- Conversion --min if attached min as l_min then a_target.append (" min=%"") - a_target.append (l_min) + a_target.append ((create {HTML_ENCODER}).encoded_string (l_min)) a_target.append_character ('%"') end --max if attached max as l_max then a_target.append (" max=%"") - a_target.append (l_max) + a_target.append ((create {HTML_ENCODER}).encoded_string (l_max)) a_target.append_character ('%"') end --step if attached step as l_step then a_target.append (" step=%"") - a_target.append (l_step) + a_target.append ((create {HTML_ENCODER}).encoded_string (l_step)) a_target.append_character ('%"') end end diff --git a/library/server/wsf_html/form/wsf_form_image_input.e b/library/server/wsf_html/form/wsf_form_image_input.e index 2fe880c2..15315236 100644 --- a/library/server/wsf_html/form/wsf_form_image_input.e +++ b/library/server/wsf_html/form/wsf_form_image_input.e @@ -12,7 +12,7 @@ inherit redefine specific_input_attributes_string end - WSF_FORM_WITH_ATLERNATIVE_ACTIONS + WSF_FORM_WITH_ALTERNATIVE_ACTIONS create diff --git a/library/server/wsf_html/form/wsf_form_input_with_html5.e b/library/server/wsf_html/form/wsf_form_input_with_html5.e index 05f1fa81..d36f4e94 100644 --- a/library/server/wsf_html/form/wsf_form_input_with_html5.e +++ b/library/server/wsf_html/form/wsf_form_input_with_html5.e @@ -39,7 +39,7 @@ feature -- Change element placeholder_set: attached placeholder as l_placeholder implies l_placeholder = a_placeholder end - set_autofocus + enable_autofocus -- Set autofocus in True. do autofocus := True @@ -47,7 +47,7 @@ feature -- Change element autofocus_true: autofocus end - unset_autofocus + disable_autofocus -- Set autofocus in False do autofocus := False @@ -55,7 +55,7 @@ feature -- Change element autofocus_false: not autofocus end - turn_off_autocomplete + disable_autocomplete -- Turn off the autocompelte. The default behavior is on. do autocomplete := True @@ -63,7 +63,7 @@ feature -- Change element autocomplete_true: autocomplete end - turn_on_autocomplete + enable_autocomplete -- Set autocomplete in False, Set default behavior. do autocomplete := False @@ -71,7 +71,7 @@ feature -- Change element autocomplete_false: not autocomplete end - set_required + enable_required -- Set required to True. do required := True @@ -79,7 +79,7 @@ feature -- Change element required_true: required end - unset_required + disable_required -- Set rquired to False. do required := False @@ -147,7 +147,7 @@ feature -- Conversion do if attached placeholder as l_placeholder then a_target.append (" placeholder=%"") - a_target.append (l_placeholder) + a_target.append ((create {HTML_ENCODER}).encoded_string (l_placeholder)) a_target.append_character ('%"') end --TODO check how we can add xhtml5 support @@ -166,7 +166,7 @@ feature -- Conversion end if attached pattern as l_pattern then a_target.append (" pattern=%"") - a_target.append (l_pattern) + a_target.append ((create {HTML_ENCODER}).encoded_string (l_pattern)) a_target.append_character ('%"') end end diff --git a/library/server/wsf_html/form/wsf_form_month_input.e b/library/server/wsf_html/form/wsf_form_month_input.e index 8843ff23..85dc04d1 100644 --- a/library/server/wsf_html/form/wsf_form_month_input.e +++ b/library/server/wsf_html/form/wsf_form_month_input.e @@ -14,7 +14,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/tests/server/wsf_html/wsf_form_number_input.e b/library/server/wsf_html/form/wsf_form_number_input.e similarity index 94% rename from tests/server/wsf_html/wsf_form_number_input.e rename to library/server/wsf_html/form/wsf_form_number_input.e index 7a055761..648fd4b7 100644 --- a/tests/server/wsf_html/wsf_form_number_input.e +++ b/library/server/wsf_html/form/wsf_form_number_input.e @@ -18,7 +18,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/tests/server/wsf_html/wsf_form_range_input.e b/library/server/wsf_html/form/wsf_form_range_input.e similarity index 93% rename from tests/server/wsf_html/wsf_form_range_input.e rename to library/server/wsf_html/form/wsf_form_range_input.e index 5b61b9b7..806d4751 100644 --- a/tests/server/wsf_html/wsf_form_range_input.e +++ b/library/server/wsf_html/form/wsf_form_range_input.e @@ -17,7 +17,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_submit_input.e b/library/server/wsf_html/form/wsf_form_submit_input.e index e289fd28..dd4af67b 100644 --- a/library/server/wsf_html/form/wsf_form_submit_input.e +++ b/library/server/wsf_html/form/wsf_form_submit_input.e @@ -12,7 +12,7 @@ inherit redefine specific_input_attributes_string end - WSF_FORM_WITH_ATLERNATIVE_ACTIONS + WSF_FORM_WITH_ALTERNATIVE_ACTIONS create make, diff --git a/library/server/wsf_html/form/wsf_form_time_input.e b/library/server/wsf_html/form/wsf_form_time_input.e index 260a82b8..dfbf507b 100644 --- a/library/server/wsf_html/form/wsf_form_time_input.e +++ b/library/server/wsf_html/form/wsf_form_time_input.e @@ -13,7 +13,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_week_input.e b/library/server/wsf_html/form/wsf_form_week_input.e index 334827b4..00778c84 100644 --- a/library/server/wsf_html/form/wsf_form_week_input.e +++ b/library/server/wsf_html/form/wsf_form_week_input.e @@ -18,7 +18,7 @@ inherit specific_input_attributes_string end - WSF_FORM_WITH_NUMERIC_ATTRIBUTE + WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE create make, diff --git a/library/server/wsf_html/form/wsf_form_with_atlernative_actions.e b/library/server/wsf_html/form/wsf_form_with_alternative_actions.e similarity index 96% rename from library/server/wsf_html/form/wsf_form_with_atlernative_actions.e rename to library/server/wsf_html/form/wsf_form_with_alternative_actions.e index 69644aef..fc5183b4 100644 --- a/library/server/wsf_html/form/wsf_form_with_atlernative_actions.e +++ b/library/server/wsf_html/form/wsf_form_with_alternative_actions.e @@ -1,13 +1,14 @@ note description: "[ Represent alternative actions for forms - The formaction, formenctype, formmethod, and formtarget attributes. + The formaction, formenctype, formmethod, and formtarget attributes. ]" date: "$Date$" revision: "$Revision$" + EIS: "name=form submission", "src=https://html.spec.whatwg.org/multipage/forms.html#form-submission" class - WSF_FORM_WITH_ATLERNATIVE_ACTIONS + WSF_FORM_WITH_ALTERNATIVE_ACTIONS feature -- Access diff --git a/tests/server/wsf_html/application.e b/tests/server/wsf_html/application.e index 2994585f..e01ae5d5 100644 --- a/tests/server/wsf_html/application.e +++ b/tests/server/wsf_html/application.e @@ -44,21 +44,21 @@ feature {NONE} -- Initialization -- autofocus create l_text_input.make ("fullname") - l_text_input.set_autofocus + l_text_input.enable_autofocus print (l_text_input.to_html (l_theme)) io.put_new_line -- autocomplete create l_text_input.make ("fullname") - l_text_input.turn_off_autocomplete + l_text_input.disable_autocomplete print (l_text_input.to_html (l_theme)) io.put_new_line -- required create l_text_input.make ("fullname") - l_text_input.set_required + l_text_input.enable_required print (l_text_input.to_html (l_theme)) io.put_new_line diff --git a/tests/server/wsf_html/wsf_form_input_html5_test_set.e b/tests/server/wsf_html/wsf_form_input_html5_test_set.e index fc07749a..cb9944f8 100644 --- a/tests/server/wsf_html/wsf_form_input_html5_test_set.e +++ b/tests/server/wsf_html/wsf_form_input_html5_test_set.e @@ -43,11 +43,11 @@ feature -- Test routines create l_theme.make create l_text_input.make ("fullname") - l_text_input.set_autofocus + l_text_input.enable_autofocus assert ("expected input with autofocus",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autofocus) ) - l_text_input.unset_autofocus + l_text_input.disable_autofocus l_autofocus := "
" assert ("expected input without autofocus",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autofocus) ) @@ -65,10 +65,10 @@ feature -- Test routines create l_theme.make create l_text_input.make ("fullname") - l_text_input.turn_off_autocomplete + l_text_input.disable_autocomplete assert ("expected input with autocomplete in off",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autocomplete) ) - l_text_input.turn_on_autocomplete + l_text_input.enable_autocomplete l_autocomplete := "
" assert ("expected input without autocomplete",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autocomplete) ) @@ -85,11 +85,11 @@ feature -- Test routines create l_theme.make create l_text_input.make ("fullname") - l_text_input.set_required + l_text_input.enable_required assert ("expected input with required",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_required) ) - l_text_input.unset_required + l_text_input.disable_required l_required := "
" assert ("expected input without required",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_required) )