browser.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 .isMac', assert => {
  18. let stub = sinon.stub(App.Browser, 'detection')
  19. stub.returns({
  20. browser: {
  21. major: "48",
  22. name: "Chrome",
  23. version: "48.0.2564.109",
  24. },
  25. os: {
  26. name: "Mac OS",
  27. version: "10.11.3",
  28. }
  29. })
  30. assert.ok(App.Browser.isMac())
  31. stub.returns({
  32. browser: {
  33. major: "48",
  34. name: "Chrome",
  35. version: "48.0.2564.109",
  36. },
  37. os: {
  38. name: "Debian McDebian",
  39. version: "14.10",
  40. }
  41. })
  42. assert.notOk(App.Browser.isMac())
  43. stub.returns({
  44. browser: {
  45. major: "48",
  46. name: "Chrome",
  47. version: "48.0.2564.109",
  48. },
  49. os: {}
  50. })
  51. assert.notOk(App.Browser.isMac())
  52. stub.restore()
  53. })