From ffa51ea9fd7f3103e55d5b273fe7e1ff0ca1e968 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Sat, 11 Aug 2018 23:02:01 +0200 Subject: [PATCH] test: add tests for MediaQuery.atLeast() --- test/javascript/util/mediaQuery.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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; + }); + + }); }); -- 2.47.2