index.test.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. const assert = require('assert');
  3. const isColorStop = require('..');
  4. describe('is-color-stop', function () {
  5. it('isColorStop', function () {
  6. assert.ok(isColorStop('yellow'));
  7. assert.ok(isColorStop('yellow', '12px'));
  8. assert.ok(!isColorStop('yellow', 'px'));
  9. assert.ok(isColorStop('yellow', 'calc(100%)'));
  10. });
  11. it('isColor', function () {
  12. assert.ok(isColorStop.isColor('rgb(255, 255, 255)'));
  13. });
  14. it('isRGB', function () {
  15. assert.ok(isColorStop.isRGB('rgb(255, 255, 255)'));
  16. });
  17. it('isRGBA', function () {
  18. assert.ok(isColorStop.isRGBA('rgba(255, 255, 255, .9)'));
  19. });
  20. it('isHSL', function () {
  21. assert.ok(isColorStop.isHSL('hsl(123, 45%, 67%)'));
  22. });
  23. it('isHSLA', function () {
  24. assert.ok(isColorStop.isHSLA('hsla(123, 45%, 67%, .9)'));
  25. });
  26. it('isHex', function () {
  27. assert.ok(isColorStop.isHex('#123456'));
  28. });
  29. it('isCSSColorName', function () {
  30. assert.ok(isColorStop.isCSSColorName('yellow'));
  31. });
  32. it('isTransparent', function () {
  33. assert.ok(isColorStop.isTransparent('transparent'));
  34. });
  35. it('isCSSLengthUnit', function () {
  36. assert.ok(isColorStop.isCSSLengthUnit('px'));
  37. });
  38. });