diff --git a/package-lock.json b/package-lock.json index 96c392244f..63a1a517aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -97,6 +97,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.7.tgz", "integrity": "sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ==", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.5.5", "@babel/generator": "^7.7.7", @@ -2257,6 +2258,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -7447,6 +7449,7 @@ "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.1.tgz", "integrity": "sha512-/ABUy3gYWu5iBmrUSRBP97JLpQUm0GgVveDCp6t3yRNIoltIYw7rEj3g5y1o2PGPR2vfTRGa7WC/LZHLTXnEzA==", "dev": true, + "peer": true, "dependencies": { "dateformat": "~4.6.2", "eventemitter2": "~0.4.13", @@ -11292,6 +11295,7 @@ "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", @@ -12433,6 +12437,7 @@ "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", "dev": true, + "peer": true, "dependencies": { "@samverschueren/stream-to-observable": "^0.3.0", "is-observable": "^1.1.0", diff --git a/test/unit/accessibility/color_namer.js b/test/unit/accessibility/color_namer.js new file mode 100644 index 0000000000..a9cdb0019b --- /dev/null +++ b/test/unit/accessibility/color_namer.js @@ -0,0 +1,46 @@ +suite('accessibility/color_namer', function () { + let myp5; + + setup(function () { + myp5 = new p5(function () {}); + }); + + teardown(function () { + myp5.remove(); + }); + + test('should be a function', function () { + assert.ok(myp5._rgbColorName); + assert.typeOf(myp5._rgbColorName, 'function'); + }); + + test('should return black for black rgba', function () { + const name = myp5._rgbColorName([0, 0, 0, 255]); + assert.equal(name, 'black'); + }); + + test('should return white for white rgba', function () { + const name = myp5._rgbColorName([255, 255, 255, 255]); + assert.equal(name, 'white'); + }); + + test('should return red for red rgba', function () { + const name = myp5._rgbColorName([255, 0, 0, 255]); + assert.equal(name, 'red'); + }); + + test('should return green for green rgba', function () { + const name = myp5._rgbColorName([0, 255, 0, 255]); + assert.equal(name, 'green'); + }); + + test('should return blue for blue rgba', function () { + const name = myp5._rgbColorName([0, 0, 255, 255]); + assert.equal(name, 'blue'); + }); + + test('should handle gray color exception correctly', function () { + const name = myp5._rgbColorName([211, 211, 211, 255]); + assert.equal(name, 'gray'); + }); +});