From bb60af528d8062034803d373f86821a5029fdee6 Mon Sep 17 00:00:00 2001 From: Jack OConnor Date: Sun, 14 Jan 2024 11:24:31 +0000 Subject: [PATCH] Fix tests --- src/spec/tests/options/useFullscreenPopup.js | 38 +++++++------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/spec/tests/options/useFullscreenPopup.js b/src/spec/tests/options/useFullscreenPopup.js index 34693670b..a5fbee1f5 100644 --- a/src/spec/tests/options/useFullscreenPopup.js +++ b/src/spec/tests/options/useFullscreenPopup.js @@ -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(); + }) \ No newline at end of file