mirror of
https://github.com/videojs/video.js.git
synced 2024-12-23 02:04:34 +02:00
17 lines
485 B
JavaScript
17 lines
485 B
JavaScript
/* eslint-env qunit */
|
|
import * as Num from '../../../src/js/utils/num';
|
|
|
|
QUnit.module('utils/num', function() {
|
|
|
|
QUnit.module('clamp');
|
|
|
|
QUnit.test('keep a number between min/max values', function(assert) {
|
|
assert.expect(5);
|
|
assert.strictEqual(Num.clamp(5, 1, 10), 5);
|
|
assert.strictEqual(Num.clamp(5, 1, 5), 5);
|
|
assert.strictEqual(Num.clamp(5, 1, 2), 2);
|
|
assert.strictEqual(Num.clamp(-1, 1, 10), 1);
|
|
assert.strictEqual(Num.clamp(NaN, 1, 10), 1);
|
|
});
|
|
});
|