You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
'use strict';
|
|
|
|
var lab = exports.lab = require('@hapi/lab').script();
|
|
var code = require('code');
|
|
|
|
var matchMedia = require('../');
|
|
|
|
function noop(){}
|
|
|
|
lab.experiment('matchMedia', function(){
|
|
|
|
lab.test('compares a media query to a value object', function(done){
|
|
var mql = matchMedia('(max-width: 123px)', { width: 123 });
|
|
code.expect(mql.matches).to.equal(true);
|
|
code.expect(mql.media).to.equal('(max-width: 123px)');
|
|
});
|
|
|
|
lab.test('no unit', function(done){
|
|
var mql = matchMedia('(max-width: 123)', { width: 123 });
|
|
code.expect(mql.matches).to.equal(true);
|
|
code.expect(mql.media).to.equal('(max-width: 123)');
|
|
});
|
|
|
|
lab.test('can attempt to addListener on server', function(done){
|
|
var mql = matchMedia('(max-width: 123px)', { width: 123 });
|
|
mql.addListener(noop);
|
|
});
|
|
|
|
lab.test('can attempt to removeListener on server', function(done){
|
|
var mql = matchMedia('(max-width: 123px)', { width: 123 });
|
|
mql.removeListener(noop);
|
|
});
|
|
|
|
lab.test('can attempt to dispose on server', function(done){
|
|
var mql = matchMedia('(max-width: 123px)', { width: 123 });
|
|
mql.removeListener(noop);
|
|
});
|
|
|
|
});
|