UNPKG

pwa-helpers

Version:

Small helper methods or mixins to help you build web apps.

42 lines (38 loc) 1.55 kB
<!-- @license Copyright (c) 2018 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>media-query</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="../node_modules/chai/chai.js"></script> <script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/wct-mocha/wct-mocha.js"></script> </head> <body> <script type="module"> import sinon from 'sinon'; import { installMediaQueryWatcher } from '../media-query.js'; suite('media-query tests', () => { test('match should use callback', () => { const callback = sinon.spy(); installMediaQueryWatcher('(min-width: 1px)', callback); assert.isTrue(callback.lastCall.args[0]); }); test('mismatch should use callback', () => { const callback = sinon.spy(); installMediaQueryWatcher('(min-width: 10000px)', callback); assert.isFalse(callback.lastCall.args[0]); }); }); </script> </body> </html>