@carbon/styles 0.16.0-rc.0 → 0.16.2

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.
Files changed (75) hide show
  1. package/package.json +17 -9
  2. package/scss/__tests__/__snapshots__/colors-test.js.snap +404 -0
  3. package/scss/__tests__/__snapshots__/config-test.js.snap +15 -0
  4. package/scss/__tests__/__snapshots__/motion-test.js.snap +39 -0
  5. package/scss/__tests__/breakpoint-test.js +42 -0
  6. package/scss/__tests__/colors-test.js +28 -0
  7. package/scss/__tests__/config-test.js +53 -0
  8. package/scss/__tests__/grid-test.js +48 -0
  9. package/scss/__tests__/layer-test.js +82 -0
  10. package/scss/__tests__/motion-test.js +37 -0
  11. package/scss/__tests__/reset-test.js +28 -0
  12. package/scss/__tests__/theme-test.js +151 -0
  13. package/scss/__tests__/themes-test.js +36 -0
  14. package/scss/__tests__/type-test.js +78 -0
  15. package/scss/_config.scss +5 -0
  16. package/scss/_reset.scss +1 -1
  17. package/scss/components/__tests__/accordion-test.js +47 -0
  18. package/scss/components/__tests__/breadcrumb-test.js +27 -0
  19. package/scss/components/__tests__/button-test.js +71 -0
  20. package/scss/components/__tests__/checkbox-test.js +27 -0
  21. package/scss/components/__tests__/code-snippet-test.js +44 -0
  22. package/scss/components/__tests__/combo-box-test.js +27 -0
  23. package/scss/components/__tests__/content-switcher-test.js +27 -0
  24. package/scss/components/__tests__/copy-button-test.js +27 -0
  25. package/scss/components/__tests__/data-table-test.js +85 -0
  26. package/scss/components/__tests__/date-picker-test.js +26 -0
  27. package/scss/components/__tests__/dropdown-test.js +27 -0
  28. package/scss/components/__tests__/file-uploader.js +27 -0
  29. package/scss/components/__tests__/form-test.js +43 -0
  30. package/scss/components/__tests__/inline-loading-test.js +26 -0
  31. package/scss/components/__tests__/link-test.js +26 -0
  32. package/scss/components/__tests__/list-box-test.js +36 -0
  33. package/scss/components/__tests__/list-test.js +26 -0
  34. package/scss/components/__tests__/loading-test.js +26 -0
  35. package/scss/components/__tests__/menu-test.js +27 -0
  36. package/scss/components/__tests__/modal-test.js +27 -0
  37. package/scss/components/__tests__/multiselect-test.js +27 -0
  38. package/scss/components/__tests__/notification-test.js +49 -0
  39. package/scss/components/__tests__/number-input-test.js +27 -0
  40. package/scss/components/__tests__/overflow-menu-test.js +27 -0
  41. package/scss/components/__tests__/pagination-nav-test.js +26 -0
  42. package/scss/components/__tests__/pagination-test.js +26 -0
  43. package/scss/components/__tests__/progress-bar-test.js +26 -0
  44. package/scss/components/__tests__/progress-indicator-test.js +26 -0
  45. package/scss/components/__tests__/radio-button-test.js +25 -0
  46. package/scss/components/__tests__/search-test.js +25 -0
  47. package/scss/components/__tests__/select-test.js +26 -0
  48. package/scss/components/__tests__/skeleton-test.js +26 -0
  49. package/scss/components/__tests__/slider-test.js +26 -0
  50. package/scss/components/__tests__/structured-list-test.js +27 -0
  51. package/scss/components/__tests__/tabs-test.js +27 -0
  52. package/scss/components/__tests__/tag-test.js +25 -0
  53. package/scss/components/__tests__/text-area-test.js +26 -0
  54. package/scss/components/__tests__/text-input-test.js +26 -0
  55. package/scss/components/__tests__/tile-test.js +26 -0
  56. package/scss/components/__tests__/time-picker-test.js +26 -0
  57. package/scss/components/__tests__/toggle-test.js +27 -0
  58. package/scss/components/__tests__/tooltip-test.js +25 -0
  59. package/scss/components/__tests__/treeview-test.js +25 -0
  60. package/scss/components/__tests__/ui-shell-test.js +27 -0
  61. package/scss/components/data-table/_data-table.scss +21 -7
  62. package/scss/components/data-table/action/_data-table-action.scss +17 -19
  63. package/scss/components/data-table/sort/_data-table-sort.scss +1 -0
  64. package/scss/components/date-picker/_flatpickr.scss +2 -2
  65. package/scss/components/radio-button/_radio-button.scss +4 -3
  66. package/scss/components/select/_select.scss +7 -9
  67. package/scss/components/tabs/_tabs.scss +4 -0
  68. package/scss/fonts/__tests__/fonts-test.js +142 -0
  69. package/scss/{_grid.scss → grid/_config.scss} +3 -7
  70. package/scss/grid/_flexbox.scss +11 -0
  71. package/scss/grid/_index.scss +16 -0
  72. package/scss/{_type.scss → type/_index.scss} +1 -1
  73. package/scss/type/_reset.scss +8 -0
  74. package/scss/utilities/__tests__/custom-property-test.js +50 -0
  75. package/docs/sass.md +0 -461
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+ const css = require('css');
14
+
15
+ const { render } = SassRenderer.create(__dirname);
16
+
17
+ describe('scss/layer', () => {
18
+ it('should map layer set values to scoped $prefix--layer selectors', async () => {
19
+ const { result } = await render(`
20
+ @use '../config' with (
21
+ $prefix: 'cds',
22
+ );
23
+ @use '../layer' with (
24
+ $layer-sets: (
25
+ field: (
26
+ rgba(0, 0, 0, 0.3),
27
+ rgba(0, 0, 0, 0.2),
28
+ rgba(0, 0, 0, 0.1),
29
+ ),
30
+ background: (
31
+ rgba(0, 0, 0, 0.8),
32
+ rgba(0, 0, 0, 0.7),
33
+ rgba(0, 0, 0, 0.6),
34
+ ),
35
+ )
36
+ );
37
+ `);
38
+ const { stylesheet } = css.parse(result.css.toString());
39
+
40
+ function findSelector(stylesheet, matcher) {
41
+ return stylesheet.rules.find((rule) => {
42
+ return rule.selectors.some((selector) => {
43
+ return selector.includes(matcher);
44
+ });
45
+ });
46
+ }
47
+
48
+ function findDeclaration(rule, property) {
49
+ return rule.declarations.find((declaration) => {
50
+ return declaration.property.includes(property);
51
+ });
52
+ }
53
+
54
+ const root = findSelector(stylesheet, ':root');
55
+ const layer1 = findSelector(stylesheet, '.cds--layer-one');
56
+ const layer2 = findSelector(stylesheet, '.cds--layer-two');
57
+ const layer3 = findSelector(stylesheet, '.cds--layer-three');
58
+
59
+ expect(findDeclaration(root, '--cds-field').value).toBe(
60
+ 'rgba(0, 0, 0, 0.3)'
61
+ );
62
+ expect(findDeclaration(layer1, '--cds-field').value).toBe(
63
+ 'rgba(0, 0, 0, 0.3)'
64
+ );
65
+ expect(findDeclaration(layer2, '--cds-field').value).toBe(
66
+ 'rgba(0, 0, 0, 0.2)'
67
+ );
68
+ expect(findDeclaration(layer3, '--cds-field').value).toBe(
69
+ 'rgba(0, 0, 0, 0.1)'
70
+ );
71
+
72
+ expect(findDeclaration(layer1, '--cds-background').value).toBe(
73
+ 'rgba(0, 0, 0, 0.8)'
74
+ );
75
+ expect(findDeclaration(layer2, '--cds-background').value).toBe(
76
+ 'rgba(0, 0, 0, 0.7)'
77
+ );
78
+ expect(findDeclaration(layer3, '--cds-background').value).toBe(
79
+ 'rgba(0, 0, 0, 0.6)'
80
+ );
81
+ });
82
+ });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/motion', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:meta';
20
+ @use '../motion';
21
+
22
+ $_: get('api', (
23
+ variables: meta.module-variables('motion'),
24
+ functions: (
25
+ motion: meta.function-exists('motion', 'motion'),
26
+ ),
27
+ mixins: (
28
+ motion: meta.mixin-exists('motion', 'motion'),
29
+ ),
30
+ ));
31
+ `);
32
+
33
+ const { value: api } = get('api');
34
+
35
+ expect(api).toMatchSnapshot();
36
+ });
37
+ });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/reset', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:meta';
20
+ @use '../reset';
21
+
22
+ $_: get('mixin', meta.mixin-exists('reset', 'reset'));
23
+ `);
24
+
25
+ const { value: mixin } = get('mixin');
26
+ expect(mixin).toBe(true);
27
+ });
28
+ });
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/theme', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../theme';
22
+
23
+ $_: get('api', (
24
+ variables: map.keys(meta.module-variables('theme')),
25
+ mixins: (
26
+ theme: meta.mixin-exists('theme', 'theme'),
27
+ ),
28
+ ));
29
+ `);
30
+
31
+ const { value: api } = get('api');
32
+ expect(api.mixins).toEqual({
33
+ theme: true,
34
+ });
35
+ expect(api.variables).toMatchInlineSnapshot(`
36
+ Array [
37
+ "fallback",
38
+ "theme",
39
+ "background",
40
+ "background-active",
41
+ "background-selected",
42
+ "background-selected-hover",
43
+ "background-hover",
44
+ "background-brand",
45
+ "background-inverse",
46
+ "background-inverse-hover",
47
+ "layer-01",
48
+ "layer-active-01",
49
+ "layer-hover-01",
50
+ "layer-selected-01",
51
+ "layer-selected-hover-01",
52
+ "layer-02",
53
+ "layer-active-02",
54
+ "layer-hover-02",
55
+ "layer-selected-02",
56
+ "layer-selected-hover-02",
57
+ "layer-03",
58
+ "layer-active-03",
59
+ "layer-hover-03",
60
+ "layer-selected-03",
61
+ "layer-selected-hover-03",
62
+ "layer-selected-inverse",
63
+ "layer-selected-disabled",
64
+ "layer-accent-01",
65
+ "layer-accent-active-01",
66
+ "layer-accent-hover-01",
67
+ "layer-accent-02",
68
+ "layer-accent-active-02",
69
+ "layer-accent-hover-02",
70
+ "layer-accent-03",
71
+ "layer-accent-active-03",
72
+ "layer-accent-hover-03",
73
+ "field-01",
74
+ "field-hover-01",
75
+ "field-02",
76
+ "field-hover-02",
77
+ "field-03",
78
+ "field-hover-03",
79
+ "interactive",
80
+ "border-subtle-00",
81
+ "border-subtle-01",
82
+ "border-subtle-selected-01",
83
+ "border-subtle-02",
84
+ "border-subtle-selected-02",
85
+ "border-subtle-03",
86
+ "border-subtle-selected-03",
87
+ "border-strong-01",
88
+ "border-strong-02",
89
+ "border-strong-03",
90
+ "border-inverse",
91
+ "border-interactive",
92
+ "border-disabled",
93
+ "text-primary",
94
+ "text-secondary",
95
+ "text-placeholder",
96
+ "text-helper",
97
+ "text-error",
98
+ "text-inverse",
99
+ "text-on-color",
100
+ "text-on-color-disabled",
101
+ "text-disabled",
102
+ "link-primary",
103
+ "link-primary-hover",
104
+ "link-secondary",
105
+ "link-visited",
106
+ "link-inverse",
107
+ "link-inverse-active",
108
+ "link-inverse-hover",
109
+ "icon-primary",
110
+ "icon-secondary",
111
+ "icon-inverse",
112
+ "icon-on-color",
113
+ "icon-on-color-disabled",
114
+ "icon-disabled",
115
+ "support-error",
116
+ "support-success",
117
+ "support-warning",
118
+ "support-info",
119
+ "support-error-inverse",
120
+ "support-success-inverse",
121
+ "support-warning-inverse",
122
+ "support-info-inverse",
123
+ "support-caution-major",
124
+ "support-caution-minor",
125
+ "support-caution-undefined",
126
+ "highlight",
127
+ "overlay",
128
+ "toggle-off",
129
+ "shadow",
130
+ "focus",
131
+ "focus-inset",
132
+ "focus-inverse",
133
+ "skeleton-background",
134
+ "skeleton-element",
135
+ "layer",
136
+ "layer-active",
137
+ "layer-hover",
138
+ "layer-selected",
139
+ "layer-selected-hover",
140
+ "layer-accent",
141
+ "layer-accent-hover",
142
+ "layer-accent-active",
143
+ "field",
144
+ "field-hover",
145
+ "border-subtle",
146
+ "border-subtle-selected",
147
+ "border-strong",
148
+ ]
149
+ `);
150
+ });
151
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/themes', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../themes';
22
+
23
+ $_: get('api', map.keys(meta.module-variables('themes')));
24
+ `);
25
+
26
+ const { value: api } = get('api');
27
+ expect(api).toMatchInlineSnapshot(`
28
+ Array [
29
+ "white",
30
+ "g10",
31
+ "g90",
32
+ "g100",
33
+ ]
34
+ `);
35
+ });
36
+ });
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/type', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../type';
22
+
23
+ $_: get('api', (
24
+ variables: map.keys(meta.module-variables('type')),
25
+ mixins: (
26
+ reset: meta.mixin-exists('reset', 'type'),
27
+ type-style: meta.mixin-exists('type-style', 'type'),
28
+ font-family: meta.mixin-exists('font-family', 'type'),
29
+ default-type: meta.mixin-exists('default-type', 'type'),
30
+ ),
31
+ ));
32
+ `);
33
+
34
+ const { value: api } = get('api');
35
+ expect(api.mixins).toEqual({
36
+ reset: true,
37
+ 'type-style': true,
38
+ 'font-family': true,
39
+ 'default-type': true,
40
+ });
41
+ expect(api.variables).toMatchInlineSnapshot(`
42
+ Array [
43
+ "caption-01",
44
+ "label-01",
45
+ "helper-text-01",
46
+ "body-short-01",
47
+ "body-short-02",
48
+ "body-long-01",
49
+ "body-long-02",
50
+ "code-01",
51
+ "code-02",
52
+ "heading-01",
53
+ "heading-02",
54
+ "productive-heading-01",
55
+ "productive-heading-02",
56
+ "productive-heading-03",
57
+ "productive-heading-04",
58
+ "productive-heading-05",
59
+ "productive-heading-06",
60
+ "productive-heading-07",
61
+ "expressive-paragraph-01",
62
+ "expressive-heading-01",
63
+ "expressive-heading-02",
64
+ "expressive-heading-03",
65
+ "expressive-heading-04",
66
+ "expressive-heading-05",
67
+ "expressive-heading-06",
68
+ "quotation-01",
69
+ "quotation-02",
70
+ "display-01",
71
+ "display-02",
72
+ "display-03",
73
+ "display-04",
74
+ "tokens",
75
+ ]
76
+ `);
77
+ });
78
+ });
package/scss/_config.scss CHANGED
@@ -54,3 +54,8 @@ $prefix: 'cds' !default;
54
54
  /// @access public
55
55
  /// @group @carbon/grid
56
56
  $flex-grid-columns: 16 !default;
57
+
58
+ /// Specify if the default grid type should be the flexbox grid
59
+ /// @type Boolean
60
+ /// @group config
61
+ $use-flexbox-grid: false !default;
package/scss/_reset.scss CHANGED
@@ -6,7 +6,7 @@
6
6
  //
7
7
 
8
8
  @use 'config';
9
- @use 'type';
9
+ @use 'type/reset' as type;
10
10
 
11
11
  @mixin reset {
12
12
  /// http://meyerweb.com/eric/tools/css/reset/
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/accordion', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../accordion';
22
+
23
+ $_: get('mixin', meta.mixin-exists('accordion', 'accordion'));
24
+ $_: get('variables', map.keys(meta.module-variables('accordion')));
25
+ `);
26
+ expect(unwrap('mixin')).toBe(true);
27
+ expect(unwrap('variables')).toMatchInlineSnapshot(`
28
+ Array [
29
+ "flex-direction",
30
+ "justify-content",
31
+ "arrow-margin",
32
+ "title-margin",
33
+ "content-padding",
34
+ ]
35
+ `);
36
+ });
37
+
38
+ test('configuration', async () => {
39
+ const { unwrap } = await render(`
40
+ @use '../accordion' with (
41
+ $flex-direction: row,
42
+ );
43
+ $_: get('direction', accordion.$flex-direction);
44
+ `);
45
+ expect(unwrap('direction')).toBe('row');
46
+ });
47
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/breadcrumb', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../breadcrumb';
22
+
23
+ $_: get('mixin', meta.mixin-exists('breadcrumb', 'breadcrumb'));
24
+ `);
25
+ expect(unwrap('mixin')).toBe(true);
26
+ });
27
+ });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/button', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../button';
22
+
23
+ $_: get('mixin', meta.mixin-exists('button', 'button'));
24
+ $_: get('variables', map.keys(meta.module-variables('button')));
25
+ `);
26
+ expect(unwrap('mixin')).toBe(true);
27
+ expect(unwrap('variables')).toMatchInlineSnapshot(`
28
+ Array [
29
+ "button-font-weight",
30
+ "button-font-size",
31
+ "button-border-radius",
32
+ "button-height",
33
+ "button-padding",
34
+ "button-padding-field",
35
+ "button-padding-sm",
36
+ "button-padding-lg",
37
+ "button-padding-ghost",
38
+ "button-padding-ghost-field",
39
+ "button-padding-ghost-sm",
40
+ "button-border-width",
41
+ "button-outline-width",
42
+ "button-separator",
43
+ "button-primary",
44
+ "button-secondary",
45
+ "button-tertiary",
46
+ "button-danger-primary",
47
+ "button-danger-secondary",
48
+ "button-danger-active",
49
+ "button-primary-active",
50
+ "button-secondary-active",
51
+ "button-tertiary-active",
52
+ "button-danger-hover",
53
+ "button-primary-hover",
54
+ "button-secondary-hover",
55
+ "button-tertiary-hover",
56
+ "button-disabled",
57
+ "button-tokens",
58
+ ]
59
+ `);
60
+ });
61
+
62
+ test('configuration', async () => {
63
+ const { unwrap } = await render(`
64
+ @use '../button' with (
65
+ $button-height: 2rem,
66
+ );
67
+ $_: get('height', button.$button-height);
68
+ `);
69
+ expect(unwrap('height')).toBe('2rem');
70
+ });
71
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/checkbox', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../checkbox';
22
+
23
+ $_: get('mixin', meta.mixin-exists('checkbox', 'checkbox'));
24
+ `);
25
+ expect(unwrap('mixin')).toBe(true);
26
+ });
27
+ });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/code-snippet', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../code-snippet';
22
+
23
+ $_: get('mixin', meta.mixin-exists('code-snippet', 'code-snippet'));
24
+ $_: get('variables', map.keys(meta.module-variables('code-snippet')));
25
+ `);
26
+ expect(unwrap('mixin')).toBe(true);
27
+ expect(unwrap('variables')).toMatchInlineSnapshot(`
28
+ Array [
29
+ "copy-active",
30
+ "copy-btn-feedback",
31
+ ]
32
+ `);
33
+ });
34
+
35
+ test('configuration', async () => {
36
+ const { unwrap } = await render(`
37
+ @use '../code-snippet' with (
38
+ $copy-active: #000,
39
+ );
40
+ $_: get('background-color', code-snippet.$copy-active);
41
+ `);
42
+ expect(unwrap('background-color')).toBe('#000');
43
+ });
44
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/combo-box', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../combo-box';
22
+
23
+ $_: get('mixin', meta.mixin-exists('combo-box', 'combo-box'));
24
+ `);
25
+ expect(unwrap('mixin')).toBe(true);
26
+ });
27
+ });