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("getNumber: ", function() {
4
 
5
  describe("initialising plugin with valid US number and utils.js", function() {
6
 
7
    beforeEach(function() {
8
      intlSetup(true);
9
      input = $("<input value='+17024181234'>");
10
      iti = window.intlTelInput(input[0]);
11
    });
12
 
13
    afterEach(function() {
14
      intlTeardown();
15
    });
16
 
17
    it("calling getNumber with no args returns the number as E.164", function() {
18
      expect(iti.getNumber()).toEqual("+17024181234");
19
    });
20
 
21
    it("calling getNumber with format=INTERNATIONAL", function() {
22
      expect(iti.getNumber(intlTelInputUtils.numberFormat.INTERNATIONAL)).toEqual("+1 702-418-1234");
23
    });
24
 
25
    it("calling getNumber with format=NATIONAL", function() {
26
      expect(iti.getNumber(intlTelInputUtils.numberFormat.NATIONAL)).toEqual("(702) 418-1234");
27
    });
28
 
29
  });
30
 
31
 
32
 
33
  describe("initialising plugin with utils.js", function() {
34
 
35
    beforeEach(function() {
36
      intlSetup(true);
37
      input = $("<input>").wrap("div");
38
      iti = window.intlTelInput(input[0]);
39
    });
40
 
41
    afterEach(function() {
42
      intlTeardown();
43
    });
44
 
45
    describe("selecting American Samoa and then typing a national number", function() {
46
 
47
      beforeEach(function() {
48
        selectFlag("as");
49
        input.val("6847331234").keyup();
50
      });
51
 
52
      it("getNumber returns the correct number (with full dialcode/area code)", function() {
53
        expect(iti.getNumber()).toEqual("+16847331234");
54
      });
55
 
56
    });
57
 
58
    describe("typing a full international number for Anguilla", function() {
59
 
60
      beforeEach(function() {
61
        // important that this test contains formatting because that caused a bug before
62
        input.val("+1 264-235-1234").keyup();
63
      });
64
 
65
      it("getNumber returns the correct number", function() {
66
        expect(iti.getNumber()).toEqual("+12642351234");
67
      });
68
 
69
    });
70
 
71
  });
72
 
73
});