test_cssAngle.js (936B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test classifyAngle. 5 6 "use strict"; 7 8 const { 9 angleUtils, 10 } = require("resource://devtools/client/shared/css-angle.js"); 11 12 const CLASSIFY_TESTS = [ 13 { input: "180deg", output: "deg" }, 14 { input: "-180deg", output: "deg" }, 15 { input: "180DEG", output: "deg" }, 16 { input: "200rad", output: "rad" }, 17 { input: "-200rad", output: "rad" }, 18 { input: "200RAD", output: "rad" }, 19 { input: "0.5grad", output: "grad" }, 20 { input: "-0.5grad", output: "grad" }, 21 { input: "0.5GRAD", output: "grad" }, 22 { input: "0.33turn", output: "turn" }, 23 { input: "0.33TURN", output: "turn" }, 24 { input: "-0.33turn", output: "turn" }, 25 ]; 26 27 function run_test() { 28 for (const test of CLASSIFY_TESTS) { 29 const result = angleUtils.classifyAngle(test.input); 30 equal(result, test.output, "test classifyAngle(" + test.input + ")"); 31 } 32 }