tests for all properties in v14

This commit is contained in:
Márton Molnár
2018-11-05 08:51:32 +01:00
parent 244f5c736b
commit db9087e8cb
2 changed files with 23 additions and 3 deletions
+3 -3
View File
@@ -21,10 +21,10 @@ export interface IntlTelInputStatic {
* initialise the plugin with optional options.
* @param options options that can be provided during initialization.
*/
(node: Element, options?: IntlTelInputOptions): IntlTelInput;
(node: Element, options?: Options): Plugin;
}
export interface IntlTelInput {
export interface Plugin {
/**
* Remove the plugin from the input, and unbind any event listeners.
*/
@@ -103,7 +103,7 @@ export interface IntlTelInput {
setPlaceholderNumberType(type: NumberType): void;
}
export interface IntlTelInputOptions {
export interface Options {
/**
* Whether or not to allow the dropdown. If disabled, there is no dropdown
* arrow, and the selected flag is not clickable. Also we display the
@@ -1,4 +1,5 @@
import IntlTelInput = require("intl-tel-input");
import { NumberFormat } from "intl-tel-input";
const input = document.querySelector("#phone");
window.intlTelInput(input);
@@ -41,7 +42,13 @@ window.intlTelInput(input).setCountry('gb');
window.intlTelInput(input).setNumber('+447733123456');
window.intlTelInput(input).setPlaceholderNumberType(IntlTelInput.NumberType.FIXED_LINE);
const countryData = window.intlTelInput.getCountryData();
const country = countryData[0];
const dialCode = country.dialCode;
const iso2 = country.iso2;
const name = country.name;
window.intlTelInput.loadUtils('build/js/utils.js');
@@ -67,3 +74,16 @@ window.intlTelInput(input, {
onlyCountries: ['al'],
utilsScript: '../../build/js/utils.js'
});
window.intlTelInput(input, {
allowDropdown: false,
autoHideDialCode: false,
autoPlaceholder: "aggressive",
dropdownContainer: document.body,
excludeCountries: [ "us", "uk" ],
formatOnDisplay: false,
hiddenInput: "hidden-input",
localizedCountries: { de: "Deutschland"},
preferredCountries: ["us", "gb"],
separateDialCode: false
});