ios3.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  6. <link rel="stylesheet" href="test.css">
  7. <title>Zepto iOS3 unit tests</title>
  8. <script src="../vendor/evidence.js"></script>
  9. <script src="evidence_runner.js"></script> <script>
  10. // avoid caching
  11. (function(){
  12. function load(scripts){
  13. scripts.split(' ').forEach(function(script){
  14. document.write('<script src="../src/'+script+'.js?'+(+new Date)+'"></scr'+'ipt>')
  15. })
  16. }
  17. load('ios3 zepto ie')
  18. })()
  19. </script>
  20. </head>
  21. <body>
  22. <h1>Zepto iOS3 unit tests</h1>
  23. <p id="results">
  24. Running… see browser console for results
  25. </p>
  26. <script>
  27. (function(){
  28. Evidence('PolyfillTest', {
  29. // test to see if we augment String.prototype.trim if not supported natively
  30. testTrim: function(t){
  31. t.assertEqual("blah", " blah ".trim())
  32. t.assertEqual("bl \n ah", " bl \n ah ".trim())
  33. },
  34. // test to see if we augment Array.prototype.reduceif not supported natively
  35. testReduce: function(t){
  36. t.assertEqual(
  37. 10,
  38. [0,1,2,3,4].reduce(function(p,c){ return p+c })
  39. )
  40. t.assertEqual(
  41. 20,
  42. [0,1,2,3,4].reduce(function(p,c){ return p+c }, 10)
  43. )
  44. var flattened = [[0,1], [2,3], [4,5]].reduce(function(a,b){
  45. return a.concat(b)
  46. })
  47. t.assertEqual(6, flattened.length)
  48. for(var i=0;i<6;i++) t.assertEqual(i, flattened[i])
  49. }
  50. })
  51. })()
  52. </script>
  53. </body>
  54. </html>