From: Nicolas Coden Date: Sat, 11 Aug 2018 21:02:01 +0000 (+0200) Subject: test: add tests for MediaQuery.atLeast() X-Git-Tag: v6.6.0~1^2~2^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffa51ea9fd7f3103e55d5b273fe7e1ff0ca1e968;p=thirdparty%2Ffoundation%2Ffoundation-sites.git test: add tests for MediaQuery.atLeast() --- diff --git a/test/javascript/util/mediaQuery.js b/test/javascript/util/mediaQuery.js index 883bb8f30..458d81f16 100644 --- a/test/javascript/util/mediaQuery.js +++ b/test/javascript/util/mediaQuery.js @@ -52,5 +52,35 @@ describe('MediaQuery utils', function () { $iframe.remove(); }); + describe('atLeast()', function () { + + it('returns "false" when smaller than the given breakpoint', function () { + $iframe.attr('width', 639); // just before the "medium" breakpoint + (_window.innerWidth); // force the browser to handle the new width synchronously + + plugin.atLeast('small').should.be.true; + plugin.atLeast('medium').should.be.false; + plugin.atLeast('large').should.be.false; + }); + + it('returns "true" when being precisely on the given breakpoint', function () { + $iframe.attr('width', 1024); // just on the "large" breakpoint + (_window.innerWidth); // force the browser to handle the new width synchronously + + plugin.atLeast('medium').should.be.true; + plugin.atLeast('large').should.be.true; + plugin.atLeast('xlarge').should.be.false; + }); + + it('returns "true" when wider than the given breakpoint', function () { + $iframe.attr('width', 1201); // just after the "xlarge" breakpoint + (_window.innerWidth); // force the browser to handle the new width synchronously + + plugin.atLeast('large').should.be.true; + plugin.atLeast('xlarge').should.be.true; + plugin.atLeast('xxlarge').should.be.false; + }); + + }); });