/wheels/tests/view/assets/assetQueryString.cfc

http://cfwheels.googlecode.com/ · ColdFusion CFScript · 50 lines · 43 code · 7 blank · 0 comment · 1 complexity · e7fc3eb0370d574b6de8876856deaa2b MD5 · raw file

  1. <cfcomponent extends="wheelsMapping.Test">
  2. <cffunction name="setup">
  3. <cfscript>
  4. loc.controller = controller(name="dummy");
  5. application.wheels.assetQueryString = true;
  6. </cfscript>
  7. </cffunction>
  8. <cffunction name="teardown">
  9. <cfscript>
  10. application.wheels.assetQueryString = false;
  11. </cfscript>
  12. </cffunction>
  13. <cffunction name="test_returns_empty_string_when_set_false">
  14. <cfscript>
  15. application.wheels.assetQueryString = false;
  16. loc.e = loc.controller.$appendQueryString();
  17. assert('Len(loc.e) eq 0');
  18. </cfscript>
  19. </cffunction>
  20. <cffunction name="test_returns_string_when_set_true">
  21. <cfscript>
  22. loc.e = loc.controller.$appendQueryString();
  23. assert('IsSimpleValue(loc.e) eq true');
  24. </cfscript>
  25. </cffunction>
  26. <cffunction name="test_returns_match_when_set_to_string">
  27. <cfscript>
  28. application.wheels.assetQueryString = "MySpecificBuildNumber";
  29. loc.e = loc.controller.$appendQueryString();
  30. assert('loc.e eq "?MySpecificBuildNumber"');
  31. </cfscript>
  32. </cffunction>
  33. <cffunction name="test_returns_same_value_without_reload">
  34. <cfscript>
  35. loc.iEnd = 100;
  36. application.wheels.assetQueryString = "MySpecificBuildNumber";
  37. loc.e = loc.controller.$appendQueryString();
  38. for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
  39. assert('loc.controller.$appendQueryString() eq loc.e');
  40. assert('loc.e eq "?MySpecificBuildNumber"');
  41. </cfscript>
  42. </cffunction>
  43. </cfcomponent>