Initial import HTML5 support for attributes and input types.
Attributes - Added support for new HTML5 attributes. missing support for : form, list, and multiple attributes. Input types: added the all the new input types. Added test cases, still in progress.
This commit is contained in:
107
tests/server/wsf_html/application.e
Normal file
107
tests/server/wsf_html/application.e
Normal file
@@ -0,0 +1,107 @@
|
||||
note
|
||||
description : "test application root class"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
ARGUMENTS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Run application.
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_input_type: WSF_FORM_SUBMIT_INPUT
|
||||
l_search_type: WSF_FORM_SEARCH_INPUT
|
||||
l_email_type: WSF_FORM_EMAIL_INPUT
|
||||
l_number_type: WSF_FORM_NUMBER_INPUT
|
||||
do
|
||||
|
||||
|
||||
create l_theme.make
|
||||
-- Basic example
|
||||
create l_text_input.make_with_text ("fullname", "some text example")
|
||||
print (l_text_input.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
|
||||
|
||||
-- Placeholder
|
||||
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_placeholder ("John Doe")
|
||||
print (l_text_input.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
|
||||
-- autofocus
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_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
|
||||
print (l_text_input.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
|
||||
-- required
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_required
|
||||
print (l_text_input.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
|
||||
-- pattern
|
||||
create l_text_input.make ("product")
|
||||
|
||||
l_text_input.set_pattern ("[0-9][A-Z]{3}")
|
||||
print (l_text_input.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
|
||||
-- basic submit
|
||||
|
||||
create l_input_type.make ("Submit")
|
||||
print (l_input_type.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
-- basic submit with formnovalidate
|
||||
|
||||
create l_input_type.make ("Submit")
|
||||
l_input_type.set_formnovalidate
|
||||
print (l_input_type.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
-- input search
|
||||
create l_search_type.make ("Search")
|
||||
print (l_search_type.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
-- input email
|
||||
create l_email_type.make ("Email")
|
||||
print (l_email_type.to_html (l_theme))
|
||||
|
||||
io.put_new_line
|
||||
-- input number
|
||||
create l_number_type.make ("Price")
|
||||
l_number_type.set_min (1)
|
||||
l_number_type.set_max (10)
|
||||
l_number_type.set_step (0.5)
|
||||
print (l_number_type.to_html (l_theme))
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
21
tests/server/wsf_html/test.ecf
Normal file
21
tests/server/wsf_html/test.ecf
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="test" uuid="F428CCD3-FF90-4E80-8C60-BFF17F72F0FA">
|
||||
<target name="test">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<option warning="true">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<precompile name="base_pre" location="$ISE_PRECOMP\base-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<library name="wsf_html" location="..\..\..\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<cluster name="test" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
118
tests/server/wsf_html/wsf_form_input_html5_test_set.e
Normal file
118
tests/server/wsf_html/wsf_form_input_html5_test_set.e
Normal file
@@ -0,0 +1,118 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
WSF_FORM_INPUT_HTML5_TEST_SET
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_placeholder
|
||||
-- <input type="text" name="fullname" placeholder="John Doe">
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_placeholder: STRING
|
||||
do
|
||||
l_placeholder := "<div><input type=%"text%" name=%"fullname%" placeholder=%"John Doe%"/></div>"
|
||||
create l_theme.make
|
||||
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_placeholder ("John Doe")
|
||||
|
||||
assert ("expected input with placeholder",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_placeholder) )
|
||||
end
|
||||
|
||||
|
||||
test_autofocus
|
||||
-- <input type="text" name="fullname" autofocus>
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_autofocus: STRING
|
||||
do
|
||||
l_autofocus := "<div><input type=%"text%" name=%"fullname%" autofocus/></div>"
|
||||
create l_theme.make
|
||||
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_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_autofocus := "<div><input type=%"text%" name=%"fullname%"/></div>"
|
||||
assert ("expected input without autofocus",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autofocus) )
|
||||
|
||||
end
|
||||
|
||||
|
||||
test_autocomplete
|
||||
-- <input type="text" name="fullname" autocomplete="off">
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_autocomplete: STRING
|
||||
do
|
||||
l_autocomplete := "<div><input type=%"text%" name=%"fullname%" autocomplete=%"off%"/></div>"
|
||||
create l_theme.make
|
||||
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.turn_off_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_autocomplete := "<div><input type=%"text%" name=%"fullname%"/></div>"
|
||||
assert ("expected input without autocomplete",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_autocomplete) )
|
||||
|
||||
end
|
||||
|
||||
test_required
|
||||
-- <input type="text" name="fullname" required>
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_required: STRING
|
||||
do
|
||||
l_required := "<div><input type=%"text%" name=%"fullname%" required/></div>"
|
||||
create l_theme.make
|
||||
|
||||
create l_text_input.make ("fullname")
|
||||
l_text_input.set_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_required := "<div><input type=%"text%" name=%"fullname%"/></div>"
|
||||
assert ("expected input without required",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_required) )
|
||||
|
||||
end
|
||||
|
||||
|
||||
test_pattern
|
||||
-- <input type="text" name="product" pattern="[0-9][A-Z]{3}"/>
|
||||
local
|
||||
l_text_input: WSF_FORM_TEXT_INPUT
|
||||
l_theme: WSF_NULL_THEME
|
||||
l_pattern: STRING
|
||||
do
|
||||
l_pattern := "<div><input type=%"text%" name=%"product%" pattern=%"[0-9][A-Z]{3}%"/></div>"
|
||||
create l_theme.make
|
||||
|
||||
create l_text_input.make ("product")
|
||||
l_text_input.set_pattern ("[0-9][A-Z]{3}")
|
||||
|
||||
assert ("expected input with pattern",l_text_input.to_html (l_theme).is_case_insensitive_equal_general (l_pattern) )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
40
tests/server/wsf_html/wsf_form_number_input.e
Normal file
40
tests/server/wsf_html/wsf_form_number_input.e
Normal file
@@ -0,0 +1,40 @@
|
||||
note
|
||||
description: "[
|
||||
Represent the input type number.
|
||||
Example:
|
||||
<input type="number" min="5" max="18" step="0.5" value="9" name="shoe-size">
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
EIS: "name= Number", "src=https://html.spec.whatwg.org/multipage/forms.html#number-state-(type=number)"
|
||||
|
||||
class
|
||||
WSF_FORM_NUMBER_INPUT
|
||||
|
||||
inherit
|
||||
|
||||
WSF_FORM_INPUT
|
||||
redefine
|
||||
specific_input_attributes_string
|
||||
end
|
||||
|
||||
WSF_FORM_WITH_NUMERIC_ATTRIBUTE
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_text
|
||||
|
||||
feature -- Access
|
||||
|
||||
input_type: STRING = "number"
|
||||
|
||||
feature {NONE} -- Conversion
|
||||
|
||||
specific_input_attributes_string: detachable STRING_8
|
||||
-- Specific input attributes if any.
|
||||
-- To redefine if needed
|
||||
do
|
||||
create Result.make_empty
|
||||
append_numeric_input_attributes_to (Result)
|
||||
end
|
||||
end
|
||||
40
tests/server/wsf_html/wsf_form_range_input.e
Normal file
40
tests/server/wsf_html/wsf_form_range_input.e
Normal file
@@ -0,0 +1,40 @@
|
||||
note
|
||||
description: "[
|
||||
Represent an input type range
|
||||
Example
|
||||
<input type="range" min=0 max=100 step=20 value=50>
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_FORM_RANGE_INPUT
|
||||
|
||||
inherit
|
||||
|
||||
WSF_FORM_INPUT
|
||||
redefine
|
||||
specific_input_attributes_string
|
||||
end
|
||||
|
||||
WSF_FORM_WITH_NUMERIC_ATTRIBUTE
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_text
|
||||
|
||||
feature -- Access
|
||||
|
||||
input_type: STRING = "range"
|
||||
|
||||
|
||||
feature {NONE} -- Conversion
|
||||
|
||||
specific_input_attributes_string: detachable STRING_8
|
||||
-- Specific input attributes if any.
|
||||
-- To redefine if needed
|
||||
do
|
||||
create Result.make_empty
|
||||
append_numeric_input_attributes_to (Result)
|
||||
end
|
||||
end
|
||||
31
tests/server/wsf_html/wsf_null_theme.e
Normal file
31
tests/server/wsf_html/wsf_null_theme.e
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
note
|
||||
description: " Null theme for void-safety and test purpose."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_NULL_THEME
|
||||
|
||||
inherit
|
||||
WSF_THEME
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Core
|
||||
|
||||
site_url: STRING = ""
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
do
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user