| 1 |
www |
1 |
"use strict";
|
|
|
2 |
|
|
|
3 |
describe("customPlaceholder: init plugin with autoPlaceholder=polite and customPlaceholder function", function() {
|
|
|
4 |
|
|
|
5 |
beforeEach(function() {
|
|
|
6 |
intlSetup(true);
|
|
|
7 |
input = $("<input>").wrap("div");
|
|
|
8 |
iti = window.intlTelInput(input[0], {
|
|
|
9 |
autoPlaceholder: "polite",
|
|
|
10 |
customPlaceholder: function(placeholder) {
|
|
|
11 |
return "e.g. " + placeholder;
|
|
|
12 |
}
|
|
|
13 |
})
|
|
|
14 |
});
|
|
|
15 |
|
|
|
16 |
afterEach(function() {
|
|
|
17 |
intlTeardown();
|
|
|
18 |
});
|
|
|
19 |
|
|
|
20 |
it("sets the placeholder to the customised US number", function() {
|
|
|
21 |
expect(input.attr("placeholder")).toEqual("e.g. (201) 555-0123");
|
|
|
22 |
});
|
|
|
23 |
|
|
|
24 |
it("selecting UK updates the placeholder", function() {
|
|
|
25 |
selectFlag("gb");
|
|
|
26 |
expect(input.attr("placeholder")).toEqual("e.g. 07400 123456");
|
|
|
27 |
});
|
|
|
28 |
|
|
|
29 |
});
|