Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
"use strict";
2
 
3
describe("preferredCountries option:", function() {
4
 
5
  beforeEach(function() {
6
    intlSetup();
7
    input = $("<input>").wrap("div");
8
  });
9
 
10
  afterEach(function() {
11
    intlTeardown();
12
  });
13
 
14
 
15
 
16
  describe("init plugin with empty preferredCountries", function() {
17
 
18
    beforeEach(function() {
19
      iti = window.intlTelInput(input[0], {
20
        preferredCountries: [],
21
      });
22
    });
23
 
24
    it("defaults to the first country in the alphabet", function() {
25
      // Afghanistan
26
      expect(getSelectedFlagElement()).toHaveClass("iti__af");
27
    });
28
 
29
    it("has the right number of list items", function() {
30
      expect(getListLength()).toEqual(totalCountries);
31
    });
32
 
33
  });
34
 
35
 
36
 
37
  describe("init plugin with preferredCountries", function() {
38
 
39
    var preferredCountries;
40
 
41
    beforeEach(function() {
42
      // United Kingdom
43
      preferredCountries = ['gb'];
44
      iti = window.intlTelInput(input[0], {
45
        preferredCountries: preferredCountries,
46
      });
47
    });
48
 
49
    afterEach(function() {
50
      preferredCountries = null;
51
    });
52
 
53
    it("defaults to the first preferredCountries", function() {
54
      expect(getSelectedFlagElement()).toHaveClass(`iti__${preferredCountries[0]}`);
55
    });
56
 
57
    it("has the right number of list items", function() {
58
      expect(getListLength()).toEqual(totalCountries + preferredCountries.length);
59
    });
60
 
61
  });
62
 
63
});