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("allowDropdown:", function() {
4
 
5
  beforeEach(function() {
6
    intlSetup();
7
    input = $("<input>").appendTo("body");
8
  });
9
 
10
  afterEach(function() {
11
    intlTeardown();
12
  });
13
 
14
  describe("init plugin with allowDropdown=false", function() {
15
 
16
    beforeEach(function() {
17
      iti = window.intlTelInput(input[0], {
18
        allowDropdown: false
19
      });
20
    });
21
 
22
    it("doesn't show the arrow or generate the dropdown markup", function() {
23
      expect(getSelectedFlagContainer().find(".iti__arrow")).not.toExist();
24
      expect(getListElement()).not.toExist();
25
    });
26
 
27
    it("typing a different dial code updates the flag", function() {
28
      input.val("+4");
29
      triggerKeyOnInput("4");
30
      expect(getSelectedFlagElement()).toHaveClass("iti__gb");
31
    });
32
 
33
  });
34
 
35
  describe("init plugin with allowDropdown=false and separateDialCode=true", function() {
36
 
37
    beforeEach(function() {
38
      iti = window.intlTelInput(input[0], {
39
        allowDropdown: false,
40
        separateDialCode: true
41
      });
42
    });
43
 
44
    it("doesn't show the arrow or generate the dropdown markup", function() {
45
      expect(getSelectedFlagContainer().find(".iti__arrow")).not.toExist();
46
    });
47
 
48
    it("shows selected dial code element", function() {
49
      expect(getSelectedDialCodeElement()).toExist();
50
      expect(getSelectedDialCodeElement().text()).toEqual('+1');
51
    });
52
 
53
  });
54
 
55
  describe("init plugin with allowDropdown=true", function() {
56
 
57
    beforeEach(function() {
58
      iti = window.intlTelInput(input[0], {
59
        allowDropdown: true
60
      });
61
    });
62
 
63
    it("shows the arrow and generate the dropdown markup", function() {
64
      expect(getSelectedFlagContainer().find(".iti__arrow")).toExist();
65
      expect(getListElement()).toExist();
66
    });
67
 
68
    it("typing a different dial code updates the flag", function() {
69
      input.val("+4");
70
      triggerKeyOnInput("4");
71
      expect(getSelectedFlagElement()).toHaveClass("iti__gb");
72
    });
73
 
74
    it("clicking the selected flag shows the dropdown", function() {
75
      getSelectedFlagContainer().click();
76
      expect(getListElement()).toBeVisible();
77
    });
78
 
79
  });
80
 
81
});