From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../test/xpcshell/test_cssColor-8-digit-hex.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 devtools/client/shared/test/xpcshell/test_cssColor-8-digit-hex.js (limited to 'devtools/client/shared/test/xpcshell/test_cssColor-8-digit-hex.js') diff --git a/devtools/client/shared/test/xpcshell/test_cssColor-8-digit-hex.js b/devtools/client/shared/test/xpcshell/test_cssColor-8-digit-hex.js new file mode 100644 index 0000000000..877920294f --- /dev/null +++ b/devtools/client/shared/test/xpcshell/test_cssColor-8-digit-hex.js @@ -0,0 +1,20 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// 8 character hex colors have 256 possible alpha values compared to the +// standard 100 values possible via rgba() colors. This test ensures that they +// are stored correctly without any alpha loss. + +"use strict"; + +const { colorUtils } = require("resource://devtools/shared/css/color.js"); + +const EIGHT_CHARACTER_HEX = "#fefefef0"; + +// eslint-disable-next-line +function run_test() { + const cssColor = new colorUtils.CssColor(EIGHT_CHARACTER_HEX); + const color = cssColor.toString(colorUtils.CssColor.COLORUNIT.hex); + + equal(color, EIGHT_CHARACTER_HEX, "alpha value is correct"); +} -- cgit v1.2.3