@splunk/themes 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 0.16.1 - June 6, 2023
5
+ ----------
6
+ API Changes:
7
+ * Added support for the latest `styled-components@5` (SUI-5467).
8
+
4
9
  0.16.0 - April 6, 2023
5
10
  ----------
6
11
  New Features:
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _chai = require("chai");
4
-
5
- var _sinon = require("sinon");
6
-
7
3
  var _styledComponents = require("styled-components");
8
4
 
9
5
  var _variables = _interopRequireDefault(require("../../variables"));
@@ -36,80 +32,53 @@ describe('colorWithAlpha', function () {
36
32
  };
37
33
  it('sets alpha on a string value', function () {
38
34
  var result = (0, _utilityMixins.colorWithAlpha)('#70f', 0.5)(defaultProps);
39
-
40
- _chai.assert.strictEqual(result, 'rgba(119, 0, 255, 0.5)');
41
-
35
+ expect(result).toBe('rgba(119, 0, 255, 0.5)');
42
36
  var result2 = (0, _utilityMixins.colorWithAlpha)('#1700f3', 0.5)(defaultProps);
43
-
44
- _chai.assert.strictEqual(result2, 'rgba(23, 0, 243, 0.5)');
45
-
37
+ expect(result2).toBe('rgba(23, 0, 243, 0.5)');
46
38
  var result3 = (0, _utilityMixins.colorWithAlpha)('rgb(51, 162, 212)', 0.2)(defaultProps);
47
-
48
- _chai.assert.strictEqual(result3, 'rgba(51, 162, 212, 0.2)');
49
-
39
+ expect(result3).toBe('rgba(51, 162, 212, 0.2)');
50
40
  var result4 = (0, _utilityMixins.colorWithAlpha)('rgba(255, 255, 255, 0.7)', 0.2)(defaultProps);
51
-
52
- _chai.assert.strictEqual(result4, 'rgba(255, 255, 255, 0.2)');
41
+ expect(result4).toBe('rgba(255, 255, 255, 0.2)');
53
42
  });
54
43
  it('sets alpha on a variable', function () {
55
44
  var result = (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, 0.5)(defaultProps);
56
-
57
- _chai.assert.strictEqual(result, 'rgba(255, 255, 255, 0.5)');
58
-
45
+ expect(result).toBe('rgba(255, 255, 255, 0.5)');
59
46
  var result2 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].contentColorDefault, 0.2)(defaultProps);
60
-
61
- _chai.assert.strictEqual(result2, 'rgba(181, 181, 181, 0.2)');
62
-
47
+ expect(result2).toBe('rgba(181, 181, 181, 0.2)');
63
48
  var result3 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].contentColorDefault, 0.3)(enterpriseLightProps);
64
-
65
- _chai.assert.strictEqual(result3, 'rgba(60, 68, 77, 0.3)');
66
-
49
+ expect(result3).toBe('rgba(60, 68, 77, 0.3)');
67
50
  var result4 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(enterpriseLightProps);
68
-
69
- _chai.assert.strictEqual(result4, 'rgba(92, 192, 92, 0.3)');
51
+ expect(result4).toBe('rgba(92, 192, 92, 0.3)');
70
52
  });
71
53
  it('defaults to black for undefined variable', function () {
72
- var consoleStub = (0, _sinon.stub)(console, 'warn');
73
- var result4 = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(defaultProps);
74
-
75
- _chai.assert.strictEqual(result4, 'rgba(0, 0, 0, 0.3)');
76
-
77
- _chai.assert.isTrue(consoleStub.calledOnce, "The colorWithAlpha's console warning was called");
78
-
79
- _chai.assert.strictEqual(consoleStub.args[0][0], "The variable 'brandColor' does not exist in the theme 'prisma dark comfortable'.");
80
-
81
- consoleStub.restore();
54
+ var consoleWarn = jest.spyOn(console, 'warn').mockImplementation();
55
+ var result = (0, _utilityMixins.colorWithAlpha)(_variables["default"].brandColor, 0.3)(defaultProps);
56
+ expect(result).toBe('rgba(0, 0, 0, 0.3)');
57
+ expect(consoleWarn).toHaveBeenCalled();
58
+ expect(consoleWarn).toHaveBeenCalledWith("The variable 'brandColor' does not exist in the theme 'prisma dark comfortable'.");
59
+ consoleWarn.mockRestore();
82
60
  });
83
61
  it('warns developers of invalid alpha prop at runtime', function () {
84
- var consoleStub = (0, _sinon.stub)(console, 'warn');
62
+ var consoleWarn = jest.spyOn(console, 'warn').mockImplementation();
85
63
  (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, 1.1)(defaultProps);
86
- (0, _utilityMixins.colorWithAlpha)(_variables["default"].white, -0.1)(defaultProps);
87
-
88
- _chai.assert.isTrue(consoleStub.calledTwice, "The colorWithAlpha's console warning was called twice");
89
-
90
- _chai.assert.strictEqual(consoleStub.args[0][0], 'The alpha value "1.1" is not within acceptable 0-1 range.');
91
-
92
- _chai.assert.strictEqual(consoleStub.args[1][0], 'The alpha value "-0.1" is not within acceptable 0-1 range.');
93
-
94
- consoleStub.restore();
64
+ expect(consoleWarn).toHaveBeenCalled();
65
+ expect(consoleWarn).toHaveBeenCalledWith('The alpha value "1.1" is not within acceptable 0-1 range.');
66
+ consoleWarn.mockRestore();
95
67
  });
96
68
  });
97
69
  describe('overlayColors', function () {
98
70
  var defaultProps = {};
99
71
  it('overlays two string values', function () {
100
72
  var result = (0, _utilityMixins.overlayColors)('#f0f', 'rgba(255, 255, 128, 0.5)')(defaultProps);
101
-
102
- _chai.assert.strictEqual(result, 'rgb(255, 128, 192)');
73
+ expect(result).toBe('rgb(255, 128, 192)');
103
74
  });
104
75
  it('overlays a solid color', function () {
105
76
  var result = (0, _utilityMixins.overlayColors)('#f39', _variables["default"].black)(defaultProps);
106
-
107
- _chai.assert.strictEqual(result, 'rgb(0, 0, 0)');
77
+ expect(result).toBe('rgb(0, 0, 0)');
108
78
  });
109
79
  it('uses default theme variables', function () {
110
80
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].interactiveColorPrimary, _variables["default"].interactiveColorOverlayHover)(defaultProps);
111
-
112
- _chai.assert.strictEqual(result, 'rgb(67, 152, 255)');
81
+ expect(result).toBe('rgb(67, 152, 255)');
113
82
  });
114
83
  var enterpriseLightProps = {
115
84
  theme: {
@@ -121,13 +90,11 @@ describe('overlayColors', function () {
121
90
  };
122
91
  it('uses Enterprise variables', function () {
123
92
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].brandColor, 'rgba(255, 255, 255, 0.5)')(enterpriseLightProps);
124
-
125
- _chai.assert.strictEqual(result, 'rgb(174, 224, 174)');
93
+ expect(result).toBe('rgb(174, 224, 174)');
126
94
  });
127
95
  it('defaults to black for undefined colors', function () {
128
96
  var result = (0, _utilityMixins.overlayColors)(_variables["default"].brandColor, 'rgba(255, 255, 255, 0.5)')(defaultProps);
129
-
130
- _chai.assert.strictEqual(result, 'rgb(128, 128, 128)');
97
+ expect(result).toBe('rgb(128, 128, 128)');
131
98
  });
132
99
  });
133
100
  describe('passes TS verification', function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/themes",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Theme variables and mixins for the Splunk design language",
5
5
  "scripts": {
6
6
  "babel": "babel src -d . --ignore src/babel-plugin-base64-png,src/tests --ignore \"**/docs\" --extensions .js,.ts,.tsx",
@@ -27,7 +27,7 @@
27
27
  "@storybook/components": ">= 6.x",
28
28
  "@storybook/theming": ">= 6.x",
29
29
  "react": "^16.8",
30
- "styled-components": "5.1.1"
30
+ "styled-components": "^5.3.10"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "react": {
@@ -74,14 +74,14 @@
74
74
  "@storybook/api": "^6.5.9",
75
75
  "@storybook/components": "^6.5.9",
76
76
  "@storybook/theming": "^6.5.9",
77
+ "@testing-library/jest-dom": "^5.16.1",
78
+ "@testing-library/react": "^12.1.2",
79
+ "@testing-library/react-hooks": "^7.0.2",
77
80
  "@typescript-eslint/eslint-plugin": "^3.4.0",
78
81
  "@typescript-eslint/parser": "^3.4.0",
79
82
  "babel-eslint": "^10.1.0",
80
83
  "babel-plugin-transform-define": "^2.0.0",
81
- "chai": "^3.5.0",
82
84
  "cross-env": "^6.0.3",
83
- "enzyme": "^3.11.0",
84
- "enzyme-adapter-react-16": "^1.15.2",
85
85
  "eslint": "^7.4.0",
86
86
  "eslint-config-airbnb": "^18.2.0",
87
87
  "eslint-config-prettier": "^6.11.0",
@@ -92,7 +92,7 @@
92
92
  "jest": "^25.1.0",
93
93
  "jest-styled-components": "^7.0.8",
94
94
  "react": "^16.12.0",
95
- "styled-components": "5.1.1",
95
+ "styled-components": "^5.3.10",
96
96
  "typescript": "^4.0.5",
97
97
  "webpack": "^4.16.2",
98
98
  "webpack-cli": "^4.9.2",
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Setup testing-library for react and jest-dom matchers
3
+ * This file needs to be included in tsconfig for the types from @testing-library/jest-dom
4
+ * to get picked up. See: https://github.com/testing-library/jest-dom#usage
5
+ */
6
+ import { screen, configure } from '@testing-library/react';
7
+ import '@testing-library/jest-dom';
8
+
9
+ configure({ testIdAttribute: 'data-test' });