1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-07 18:39:57 +00:00
TiddlyWiki5/tw2/source/tiddlywiki/test/js/Numbers.js
Jeremy Ruston a1c8ac624f Added first pass at support for building TiddlyWiki 2.6.x with TW5
There are still some whitespace and attribute ordering issues, but the
result runs correctly.
2012-05-29 22:02:38 +01:00

29 lines
775 B
JavaScript
Executable File

jQuery(document).ready(function() {
module("Numbers");
test("Number clamp", function() {
var actual, expected;
actual = (99).clamp();
expected = 99;
same(actual, expected, "returns original number if no arguments are specified");
actual = (11).clamp(20);
expected = 20;
same(actual, expected, "if only one argument is specified, uses it as minimum");
actual = (55).clamp(20, 80);
expected = 55;
same(actual, expected, "returns original number if it is between minimum and maximum");
actual = (11).clamp(20, 80);
expected = 20;
same(actual, expected, "returns minimum if number is smaller than minimum");
actual = (99).clamp(20, 80);
expected = 80;
same(actual, expected, "returns maximum if number is greater than maximum");
});
});