Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed Jul 30, 2017
1 parent 2e397bb commit db9887c
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions src/spec/tests/core/initialValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,53 @@ describe("initial values:", function() {



describe("init vanilla plugin on input containing valid toll-free (regionless) NANP number with intl dial code", function() {
describe("input containing valid regionless NANP number with intl dial code", function() {

beforeEach(function() {
input = $("<input value='+1 800 123 1234'>");
input.intlTelInput();
});

it("does not set the selected flag or the active list item", function() {
expect(getSelectedFlagElement().attr("class")).toBe("iti-flag");
expect(getActiveListItem().length).toEqual(0);
describe("init plugin with nationalMode enabled", function() {

beforeEach(function() {
input.intlTelInput();
});

it("defaults to US flag", function() {
expect(getSelectedFlagElement()).toHaveClass("us");
});

});

describe("init plugin with nationalMode enabled and an initialCountry", function() {

var initialCountry = "ca";

beforeEach(function() {
input.intlTelInput({
initialCountry: initialCountry
});
});

it("defaults to the initialCountry flag", function() {
expect(getSelectedFlagElement()).toHaveClass(initialCountry);
});

});

describe("init plugin with nationalMode disabled", function() {

beforeEach(function() {
input.intlTelInput({
nationalMode: false
});
});

it("does not set the selected flag or the active list item", function() {
expect(getSelectedFlagElement().attr("class")).toBe("iti-flag");
expect(getActiveListItem().length).toEqual(0);
});

});

});
Expand Down

0 comments on commit db9887c

Please sign in to comment.