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("countrychange event:", function() {
4
 
5
  var spy;
6
 
7
  beforeEach(function() {
8
    intlSetup();
9
    input = $("<input>").wrap("div");
10
    spy = spyOnEvent(input, 'countrychange');
11
  });
12
 
13
  afterEach(function() {
14
    intlTeardown();
15
  });
16
 
17
  describe("init plugin", function() {
18
 
19
    beforeEach(function() {
20
      iti = window.intlTelInput(input[0])
21
    });
22
 
23
    it("does not trigger the event", function() {
24
      expect(spy).not.toHaveBeenTriggered();
25
    });
26
 
27
    it("calling setCountry triggers the event", function() {
28
      iti.setCountry("fr");
29
      expect(spy).toHaveBeenTriggered();
30
    });
31
 
32
    it("calling setNumber triggers the event", function() {
33
      iti.setNumber("+34");
34
      expect(spy).toHaveBeenTriggered();
35
    });
36
 
37
    it("selecting another country triggers the event", function() {
38
      selectFlag("af");
39
      expect(spy).toHaveBeenTriggered();
40
    });
41
 
42
    it("typing another number triggers the event", function() {
43
      input.val("+4");
44
      triggerKeyOnInput("4"); // selects uk
45
      expect(spy).toHaveBeenTriggered();
46
    });
47
  });
48
 
49
});