PageRenderTime 39ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/wheels/tests/view/urls/linkTo.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 40 lines | 33 code | 7 blank | 0 comment | 0 complexity | 40811a26a77ded543067cb50166dbf88 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 = controller(name="dummy")>
  4. <cfset oldURLRewriting = application.wheels.URLRewriting>
  5. <cfset application.wheels.URLRewriting = "On">
  6. <cfset oldScriptName = request.cgi.script_name>
  7. <cfset request.cgi.script_name = "/rewrite.cfm">
  8. </cffunction>
  9. <cffunction name="teardown">
  10. <cfset application.wheels.URLRewriting = oldURLRewriting>
  11. <cfset request.cgi.script_name = oldScriptName>
  12. </cffunction>
  13. <cffunction name="test_controller_action_only">
  14. <cfset loc.e = '<a href="#application.wheels.webpath#account/logout">Log Out</a>'>
  15. <cfset loc.r = loc.controller.linkTo(text="Log Out", controller="account", action="logout")>
  16. <cfset assert('loc.e eq loc.r')>
  17. </cffunction>
  18. <cffunction name="test_confirm_is_escaped">
  19. <cfset loc.e = '<a data-confirm="Mark as: \''Completed\''?" href="#application.wheels.webpath#">#application.wheels.webpath#</a>'>
  20. <cfset loc.r = loc.controller.linkTo(confirm="Mark as: 'Completed'?")>
  21. <cfset assert('loc.e eq loc.r')>
  22. </cffunction>
  23. <cffunction name="test_external_links">
  24. <cfset loc.e = '<a href="http://www.cfwheels.com">CFWheels</a>'>
  25. <cfset loc.r = loc.controller.linkTo(href="http://www.cfwheels.com", text="CFWheels")>
  26. <cfset assert('loc.e eq loc.r')>
  27. </cffunction>
  28. <cffunction name="test_remote_links">
  29. <cfset loc.e = '<a data-remote="true" href="#application.wheels.webpath#account/logout">Log Out</a>'>
  30. <cfset loc.r = loc.controller.linkTo(text="Log Out", controller="account", action="logout", remote="true")>
  31. <cfset assert('loc.e eq loc.r')>
  32. </cffunction>
  33. </cfcomponent>