browser.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. QUnit.test('App.Browser .magicKey', assert => {
  2. let stub = sinon.stub(App.Browser, 'isMac')
  3. stub.returns(true)
  4. assert.equal(App.Browser.magicKey(), 'cmd')
  5. stub.returns(false)
  6. assert.equal(App.Browser.magicKey(), 'ctrl')
  7. stub.restore()
  8. })
  9. QUnit.test('App.Browser .hotkeys', assert => {
  10. let stub = sinon.stub(App.Browser, 'isMac')
  11. stub.returns(true)
  12. assert.equal(App.Browser.hotkeys(), 'alt+ctrl')
  13. stub.returns(false)
  14. assert.equal(App.Browser.hotkeys(), 'ctrl+shift')
  15. stub.restore()
  16. })
  17. QUnit.test('App.Browser .hotkeysDisplay', assert => {
  18. let stub = sinon.stub(App.Browser, 'isMac')
  19. stub.returns(true)
  20. assert.deepEqual(App.Browser.hotkeysDisplay(), ['ctrl', 'option'])
  21. stub.returns(false)
  22. assert.deepEqual(App.Browser.hotkeysDisplay(), ['shift', 'ctrl'])
  23. stub.restore()
  24. })
  25. QUnit.test('App.Browser .isMac', assert => {
  26. let stub = sinon.stub(App.Browser, 'detection')
  27. stub.returns({
  28. browser: {
  29. major: "48",
  30. name: "Chrome",
  31. version: "48.0.2564.109",
  32. },
  33. os: {
  34. name: "Mac OS",
  35. version: "10.11.3",
  36. }
  37. })
  38. assert.ok(App.Browser.isMac())
  39. stub.returns({
  40. browser: {
  41. major: "48",
  42. name: "Chrome",
  43. version: "48.0.2564.109",
  44. },
  45. os: {
  46. name: "Debian McDebian",
  47. version: "14.10",
  48. }
  49. })
  50. assert.notOk(App.Browser.isMac())
  51. stub.returns({
  52. browser: {
  53. major: "48",
  54. name: "Chrome",
  55. version: "48.0.2564.109",
  56. },
  57. os: {}
  58. })
  59. assert.notOk(App.Browser.isMac())
  60. stub.restore()
  61. })