UNPKG

adcutil

Version:

Utilities tools for Askia Design Control

118 lines (104 loc) 3.89 kB
<?xml version="1.0" encoding="utf-8"?> <tests xmlns="http://www.askia.com/ADCUnitTestSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.askia.com/ADCUnitTestSchema http://www.askia.com/Downloads/dev/schemas/adc2.0/UnitTests.xsd"> <units> <test id="contains_input_number" description="Should contains an input number" cases="default_numeric"> <asserts> <placeholder> <select_nodes xPath="//input"> <assert_count is="equal" value="1"/> <assert_has_attr name="type" value="number"/> <assert_has_attr name="name" value="C1"/> <assert_has_attr name="min" value="1" /> <assert_has_attr name="max" value="5"/> </select_nodes> </placeholder> </asserts> </test> <test id="contains_select_options" description="When useList=true, should contains &lt;select&gt; with one &lt;option&gt; per possible value" cases="default_numeric"> <arrange> <properties> <property id="useList"> <value>true</value> </property> </properties> </arrange> <asserts> <placeholder> <select_nodes xPath="//select"> <assert_exist /> <assert_has_attr name="name" value="C1"/> </select_nodes> <select_nodes xPath="//option[@value='']"> <assert_count is="equal" value="1"/> </select_nodes> <select_nodes xPath="//option[@value!='']"> <assert_count is="equal" value="5"/> <assert_match> <![CDATA[value="[0-9]+"]]> </assert_match> </select_nodes> </placeholder> </asserts> </test> <test id="use_step_property" description="Should use the unitStep property" cases="default_numeric"> <arrange> <properties> <property id="unitStep"> <value>2</value> </property> </properties> </arrange> <asserts> <placeholder> <select_nodes xPath="//input"> <assert_has_attr name="step" value="2"/> </select_nodes> </placeholder> </asserts> </test> <test id="use_step_property_with_list" description="When useList=true should generate &lt;option&gt; according to the unitStep property" cases="default_numeric"> <arrange> <properties> <property id="useList"> <value>true</value> </property> <property id="unitStep"> <value>2</value> </property> </properties> </arrange> <asserts> <placeholder> <select_nodes xPath="//option[@value='']"> <assert_count is="equal" value="1"/> </select_nodes> <select_nodes xPath="//option[@value!='']"> <assert_count is="equal" value="3"/> <assert_match> <![CDATA[value="[0-9]+"]]> </assert_match> </select_nodes> </placeholder> </asserts> </test> <test id="use_placeholder" description="Should add a `placeholder` attribute when the `placeholder` property is not empty" cases="default_numeric"> <arrange> <properties> <property id="placeholder"> <value>Enter a number ...</value> </property> </properties> </arrange> <asserts> <placeholder> <select_nodes xPath="//input"> <assert_has_attr name="type" value="number"/> <assert_has_attr name="placeholder" value="Enter a number ..."/> </select_nodes> </placeholder> </asserts> </test> </units> </tests>