PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/view/forms/yearSelect.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 57 lines | 50 code | 7 blank | 0 comment | 0 complexity | 02c9776daa72f81635d1064825713258 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfset loc.controller = createobject("component", "wheelsMapping.tests._assets.controllers.ControllerWithModel")>
  4. <cfset loc.args= {}>
  5. <cfset loc.args.objectName = "user">
  6. <cfset loc.args.property = "birthday">
  7. <cfset loc.args.includeblank = false>
  8. <cfset loc.args.order = "year">
  9. <cfset loc.args.label = false>
  10. <cfset loc.controller.changeBirthday = changeBirthday>
  11. </cffunction>
  12. <cffunction name="test_startyear_lt_endyear_value_lt_startyear">
  13. <cfset loc.args.startyear = "1980">
  14. <cfset loc.args.endyear = "1990">
  15. <cfset loc.r = loc.controller.dateSelect(argumentCollection=loc.args)>
  16. <cfset debug('loc.r', false)>
  17. <cfset loc.e = '<select id="user-birthday-year" name="user[birthday]($year)"><option selected="selected" value="1975">1975</option><option value="1976">1976</option><option value="1977">1977</option><option value="1978">1978</option><option value="1979">1979</option><option value="1980">1980</option><option value="1981">1981</option><option value="1982">1982</option><option value="1983">1983</option><option value="1984">1984</option><option value="1985">1985</option><option value="1986">1986</option><option value="1987">1987</option><option value="1988">1988</option><option value="1989">1989</option><option value="1990">1990</option></select>'>
  18. <cfset assert('loc.e eq loc.r')>
  19. </cffunction>
  20. <cffunction name="test_startyear_lt_endyear_value_gt_startyear">
  21. <cfset loc.controller.changeBirthday("1995")>
  22. <cfset loc.args.startyear = "1980">
  23. <cfset loc.args.endyear = "1990">
  24. <cfset loc.r = loc.controller.dateSelect(argumentCollection=loc.args)>
  25. <cfset debug('loc.r', false)>
  26. <cfset loc.e = '<select id="user-birthday-year" name="user[birthday]($year)"><option value="1980">1980</option><option value="1981">1981</option><option value="1982">1982</option><option value="1983">1983</option><option value="1984">1984</option><option value="1985">1985</option><option value="1986">1986</option><option value="1987">1987</option><option value="1988">1988</option><option value="1989">1989</option><option value="1990">1990</option></select>'>
  27. <cfset assert('loc.e eq loc.r')>
  28. </cffunction>
  29. <cffunction name="test_startyear_gt_endyear_value_lt_endyear">
  30. <cfset loc.args.startyear = "1990">
  31. <cfset loc.args.endyear = "1980">
  32. <cfset loc.r = loc.controller.dateSelect(argumentCollection=loc.args)>
  33. <cfset debug('loc.r', false)>
  34. <cfset loc.e = '<select id="user-birthday-year" name="user[birthday]($year)"><option value="1990">1990</option><option value="1989">1989</option><option value="1988">1988</option><option value="1987">1987</option><option value="1986">1986</option><option value="1985">1985</option><option value="1984">1984</option><option value="1983">1983</option><option value="1982">1982</option><option value="1981">1981</option><option value="1980">1980</option><option value="1979">1979</option><option value="1978">1978</option><option value="1977">1977</option><option value="1976">1976</option><option selected="selected" value="1975">1975</option></select>'>
  35. <cfset assert('loc.e eq loc.r')>
  36. </cffunction>
  37. <cffunction name="test_startyear_gt_endyear_value_gt_endyear">
  38. <cfset loc.controller.changeBirthday("1995")>
  39. <cfset loc.args.startyear = "1990">
  40. <cfset loc.args.endyear = "1980">
  41. <cfset loc.r = loc.controller.dateSelect(argumentCollection=loc.args)>
  42. <cfset debug('loc.r', false)>
  43. <cfset loc.e = '<select id="user-birthday-year" name="user[birthday]($year)"><option value="1990">1990</option><option value="1989">1989</option><option value="1988">1988</option><option value="1987">1987</option><option value="1986">1986</option><option value="1985">1985</option><option value="1984">1984</option><option value="1983">1983</option><option value="1982">1982</option><option value="1981">1981</option><option value="1980">1980</option></select>'>
  44. <cfset assert('loc.e eq loc.r')>
  45. </cffunction>
  46. <cffunction name="changeBirthday">
  47. <cfargument name="value" type="any" required="true">
  48. <cfset user.birthday = arguments.value>
  49. </cffunction>
  50. </cfcomponent>