﻿<?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="datetime_contains_input_date_and_input_time" description="Should contains an input date and an input time" cases="default_datetime">
      <asserts>
        <placeholder>
          <select_nodes xPath="//input[@type='date']">
            <assert_count is="equal" value="1"/>
            <assert_has_attr name="name" value="D1"/>
          </select_nodes>
          <select_nodes xPath="//input[@type='time']">
            <assert_count is="equal" value="1" />
            <assert_has_attr name="name" value="T1"/>
          </select_nodes>
        </placeholder>
      </asserts>
    </test>

    <test id="date_contains_input_date" description="Should only contains an input date" cases="default_date">
      <asserts>
        <placeholder>
          <select_nodes xPath="//input[@type='date']">
            <assert_count is="equal" value="1"/>
            <assert_has_attr name="name" value="D1"/>
          </select_nodes>
          <select_nodes xPath="//input[@type='time']">
            <assert_not_exist />
          </select_nodes>
        </placeholder>
      </asserts>
    </test>

    <test id="time_contains_input_time" description="Should only contains an input date" cases="default_time">
      <asserts>
        <placeholder>
          <select_nodes xPath="//input[@type='time']">
            <assert_count is="equal" value="1"/>
            <assert_has_attr name="name" value="T1"/>
          </select_nodes>
          <select_nodes xPath="//input[@type='date']">
            <assert_not_exist />
          </select_nodes>
        </placeholder>
      </asserts>
    </test>

    <test id="use_placeholder_attr" description="Should add a `placeholder` attribute in the input date when the `placeholder` property is not empty" cases="default_datetime, default_date">
      <arrange>
        <properties>
          <property id="placeholder">
            <value>Enter a date ...</value>
          </property>
        </properties>
      </arrange>

      <asserts>
        <placeholder>
          <select_nodes xPath="//input[@type='date']">
            <assert_has_attr name="placeholder" value="Enter a date ..."/>
          </select_nodes>
        </placeholder>
      </asserts>
    </test>
  
    <test id="time_use_placeholder_attr" description="Should add a `placeholder` attribute in the input time when the `placeholder` property is not empty" cases="default_time">
      <arrange>
        <properties>
          <property id="placeholder">
            <value>Enter a time ...</value>
          </property>
        </properties>
      </arrange>

      <asserts>
        <placeholder>
          <select_nodes xPath="//input[@type='time']">
            <assert_has_attr name="placeholder" value="Enter a time ..."/>
          </select_nodes>
        </placeholder>
      </asserts>
    </test>

  </units>
    
</tests>

          