user.js 699 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. window.onload = function() {
  2. // .initials
  3. QUnit.test('.initials', assert => {
  4. var user = new App.User({
  5. firstname: 'Bob',
  6. lastname: 'Smith Good',
  7. })
  8. assert.equal(user.initials(), 'BS')
  9. user = new App.User({
  10. firstname: 'Bob',
  11. lastname: '',
  12. })
  13. assert.equal(user.initials(), 'Bo')
  14. user = new App.User({
  15. firstname: '',
  16. lastname: 'Smith',
  17. })
  18. assert.equal(user.initials(), 'Sm')
  19. user = new App.User({
  20. phone: '000001234',
  21. })
  22. assert.equal(user.initials(), '34')
  23. user = new App.User({
  24. mobile: '000001235',
  25. })
  26. assert.equal(user.initials(), '35')
  27. user = new App.User({
  28. login: 'login1',
  29. })
  30. assert.equal(user.initials(), '??')
  31. });
  32. }