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("setNumber: init vanilla plugin (no utils) and call setNumber with a valid UK number", function() {
4
 
5
  beforeEach(function() {
6
    intlSetup();
7
    input = $("<input>").wrap("div");
8
    iti = window.intlTelInput(input[0]);
9
    iti.setNumber("+447733123456");
10
  });
11
 
12
  afterEach(function() {
13
    intlTeardown();
14
  });
15
 
16
  it("sets the input val to the given number (no formatting)", function() {
17
    expect(getInputVal()).toEqual("+447733123456");
18
  });
19
 
20
  it("updates the flag", function() {
21
    expect(getSelectedFlagElement()).toHaveClass("iti__gb");
22
  });
23
 
24
});
25
 
26
 
27
 
28
describe("setNumber: with utils", function() {
29
 
30
  beforeEach(function() {
31
    intlSetup(true);
32
    input = $("<input>").wrap("div");
33
  });
34
 
35
  afterEach(function() {
36
    intlTeardown();
37
  });
38
 
39
  describe("init plugin with nationalMode=true and call setNumber with a valid UK number", function() {
40
 
41
    beforeEach(function() {
42
      iti = window.intlTelInput(input[0]);
43
      iti.setNumber("+447733123456");
44
    });
45
 
46
    it("sets the input val to the given number, with ntl formatting", function() {
47
      expect(getInputVal()).toEqual("07733 123456");
48
    });
49
 
50
  });
51
 
52
  describe("init plugin with nationalMode=false and call setNumber with a valid UK number", function() {
53
 
54
    beforeEach(function() {
55
      iti = window.intlTelInput(input[0], {
56
        nationalMode: false
57
      });
58
      iti.setNumber("+447733123456");
59
    });
60
 
61
    it("sets the input val to the given number, with intl formatting", function() {
62
      expect(getInputVal()).toEqual("+44 7733 123456");
63
    });
64
 
65
  });
66
 
67
});