Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed Jan 14, 2024
1 parent 6c59e37 commit bb60af5
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions src/spec/tests/options/useFullscreenPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,26 @@ describe("useFullscreenPopup: testing fullscreen behavior can be controlled", fu

afterEach(function() {
intlTeardown();
$('body').removeClass('iti-fullscreen-popup')
});

it("can enable fullscreen popup", function(){
it("can enable fullscreen popup", function() {
iti = window.intlTelInput(input[0], {
useFullscreenPopup: true,
});

expect($('body')).toHaveClass('iti-fullscreen-popup')
// no country list in markup initially
expect(getSelectedFlagContainer().find(".iti__country-list")).not.toExist();
getSelectedFlagContainer().click();
// after opening the dropdown, the dropdown container should be injected, with the right class, containing the country list
expect($('.iti--container')).toHaveClass('iti--fullscreen-popup');
expect($('.iti--container')).find(".iti__country-list").toExist();
})

it("can disable fullscreen popup", function(){
it("can disable fullscreen popup", function() {
iti = window.intlTelInput(input[0], {
useFullscreenPopup: false,
});

expect($('body')).not.toHaveClass('iti-fullscreen-popup')
})


it("can use default behavior: desktop", function(){
iti = window.intlTelInput(input[0]);

expect($('body')).not.toHaveClass('iti-fullscreen-popup')
})

// we would need to set the viewport width < 500 for this test to pass
it.skip("can use default behavior: mobile", function(){
spyOnProperty(window.navigator, 'userAgent').and.returnValue('iPhone');

iti = window.intlTelInput(input[0]);

expect($('body')).toHaveClass('iti-fullscreen-popup')
})
});
expect(getSelectedFlagContainer().find(".iti__country-list")).toExist();
getSelectedFlagContainer().click();
expect($('.iti--container')).not.toExist();
expect($('.iti--fullscreen-popup')).not.toExist();
})

0 comments on commit bb60af5

Please sign in to comment.