list.spec.js 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* global OV */
  9. describe('List model', function() {
  10. 'use strict';
  11. var list1 = {
  12. id: '001'
  13. }
  14. var list2 = {
  15. id: '002',
  16. attribute1: 'Text 1',
  17. attribute2: 'Text 2',
  18. }
  19. it('should init a list', function() {
  20. var l1 = new OV.List(list1);
  21. expect(l1.id).toBe('001');
  22. });
  23. it('should init a list with min, max, attr1 and attr2', function() {
  24. var l1 = new OV.List(list2);
  25. expect(l1.id).toBe('002');
  26. });
  27. it('should add candidates', function() {
  28. var l1 = new OV.List(list2);
  29. var c1 = new OV.Candidate('001');
  30. l1.addCandidate(c1);
  31. expect(l1.candidates.length).toBe(1);
  32. });
  33. });