@salesforce/design-system-react 0.10.50-alpha.1 → 0.10.50

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 (69) hide show
  1. package/components/accordion/__tests__/accordion.browser-test.jsx +302 -0
  2. package/components/alert/__tests__/alert.browser-test.jsx +100 -0
  3. package/components/app-launcher/__tests__/app-launcher.browser-test.jsx +228 -0
  4. package/components/app-launcher/__tests__/expandable-section.browser-test.jsx +144 -0
  5. package/components/app-launcher/__tests__/link.browser-test.jsx +107 -0
  6. package/components/app-launcher/__tests__/tile.browser-test.jsx +267 -0
  7. package/components/avatar/__tests__/avatar.browser-test.jsx +207 -0
  8. package/components/builder-header/__tests__/builder-header.browser-test.jsx +53 -0
  9. package/components/button/__tests__/button.browser-test.jsx +226 -0
  10. package/components/button-group/__tests__/button-group.browser-test.jsx +144 -0
  11. package/components/button-stateful/__tests__/button-stateful.browser-test.jsx +125 -0
  12. package/components/card/__tests__/card.browser-test.jsx +255 -0
  13. package/components/carousel/__tests__/carousel.browser-test.jsx +527 -0
  14. package/components/color-picker/__tests__/color-picker.browser-test.jsx +767 -0
  15. package/components/combobox/__tests__/combobox.browser-test.jsx +654 -0
  16. package/components/data-table/__tests__/data-table.browser-test.jsx +1051 -0
  17. package/components/date-picker/__tests__/__snapshots__/datepicker.dom-snapshot-test.jsx.snap +4429 -0
  18. package/components/date-picker/__tests__/date-picker.browser-test.jsx +497 -0
  19. package/components/date-picker/__tests__/datepicker.dom-snapshot-test.jsx +109 -0
  20. package/components/docked-composer/__tests__/docked-composer.browser-test.jsx +83 -0
  21. package/components/expandable-section/__tests__/expandable-section.browser-test.jsx +133 -0
  22. package/components/expression/__tests__/expression.browser-test.jsx +255 -0
  23. package/components/filter/__tests__/filter.browser-test.jsx +147 -0
  24. package/components/forms/input/__tests__/inline.browser-test.jsx +164 -0
  25. package/components/global-header/__tests__/global-header.browser-test.jsx +177 -0
  26. package/components/global-navigation-bar/__tests__/global-navigation-bar.browser-test.jsx +464 -0
  27. package/components/icon/__tests__/icon.browser-test.jsx +214 -0
  28. package/components/illustration/__tests__/illustration.browser-test.jsx +177 -0
  29. package/components/input/__tests__/input.browser-test.jsx +612 -0
  30. package/components/location-map/__tests__/location-map.browser-test.jsx +158 -0
  31. package/components/lookup/__tests__/lookup.browser-test.jsx +353 -0
  32. package/components/media-object/__tests__/media-object.browser-test.jsx +87 -0
  33. package/components/menu-dropdown/__tests__/dropdown.browser-test.jsx +588 -0
  34. package/components/menu-picklist/__tests__/menupicklist.snapshot-old-test.jsx +41 -0
  35. package/components/menu-picklist/__tests__/picklist-base.browser-test.jsx +275 -0
  36. package/components/modal/__tests__/modal.browser-test.jsx +333 -0
  37. package/components/notification/__tests__/notification.browser-test.jsx +113 -0
  38. package/components/page-header/__tests__/page-header.browser-test.jsx +161 -0
  39. package/components/panel/__tests__/__snapshots__/filtering.dom-snapshot-test.jsx.snap +298 -0
  40. package/components/panel/__tests__/filtering.dom-snapshot-test.jsx +9 -0
  41. package/components/pill/__tests__/pill.browser-test.jsx +308 -0
  42. package/components/pill-container/__tests__/pill-container.browser-test.jsx +186 -0
  43. package/components/popover/__tests__/popover.browser-test.jsx +327 -0
  44. package/components/progress-indicator/__tests__/progress-indicator.browser-test.jsx +335 -0
  45. package/components/radio-button-group/__tests__/radio-button-group.browser-test.jsx +122 -0
  46. package/components/radio-group/__tests__/radio-group.browser-test.jsx +119 -0
  47. package/components/setup-assistant/__tests__/setup-assistant.browser-test.jsx +77 -0
  48. package/components/slider/__tests__/slider.browser-test.jsx +389 -0
  49. package/components/spinner/__tests__/spinner.browser-test.jsx +57 -0
  50. package/components/split-view/__tests__/split-view.listbox.browser-test.jsx +225 -0
  51. package/components/split-view/__tests__/split-view.listbox.header.browser-test.jsx +158 -0
  52. package/components/split-view/__tests__/split-view.listbox.unread.browser-test.jsx +114 -0
  53. package/components/tabs/__tests__/tabs.browser-test.jsx +458 -0
  54. package/components/textarea/__tests__/textarea.browser-test.jsx +175 -0
  55. package/components/time-picker/__tests__/time-picker.browser-test.jsx +46 -0
  56. package/components/toast/__tests__/toast.browser-test.jsx +118 -0
  57. package/components/tooltip/__tests__/tooltip.browser-test.jsx +214 -0
  58. package/components/tree/__tests__/tree.browser-test.jsx +303 -0
  59. package/components/vertical-navigation/__tests__/navigation.browser-test.jsx +117 -0
  60. package/components/visual-picker/__tests__/visual-picker.browser-test.jsx +288 -0
  61. package/components/welcome-mat/__tests__/welcome-mat.browser-test.jsx +358 -0
  62. package/design-system-react-components.js +1 -1
  63. package/design-system-react-components.min.js.LICENSE.txt +1 -1
  64. package/design-system-react.js +1 -1
  65. package/design-system-react.min.js.LICENSE.txt +1 -1
  66. package/lib/design-system-react-components.min.js.LICENSE.txt +1 -1
  67. package/lib/design-system-react.min.js.LICENSE.txt +1 -1
  68. package/lib/package.json +1 -1
  69. package/package.json +1 -1
@@ -0,0 +1,214 @@
1
+ /* eslint-env mocha */
2
+ /* global sinon */
3
+ /* eslint-disable prefer-arrow-callback */
4
+ /* eslint-disable no-unused-expressions */
5
+
6
+ import React from 'react';
7
+
8
+ import chai, { expect } from 'chai';
9
+ import chaiEnzyme from 'chai-enzyme';
10
+ // `this.wrapper` and `this.dom` is set in the helpers file
11
+ import {
12
+ mountComponent,
13
+ unmountComponent,
14
+ } from '../../../tests/enzyme-helpers';
15
+
16
+ chai.use(chaiEnzyme());
17
+
18
+ import Icon from '../../icon';
19
+ import IconSettings from '../../icon-settings';
20
+
21
+ class DemoIcon extends React.Component {
22
+ static displayName = 'DemoIcon';
23
+
24
+ render() {
25
+ return <Icon {...this.props} />;
26
+ }
27
+ }
28
+
29
+ describe('SLDSIcon: ', function describeFunction() {
30
+ describe('Standard Icon Props Render', function () {
31
+ let svg;
32
+
33
+ beforeEach(
34
+ mountComponent(
35
+ <IconSettings iconPath="/assets/icons">
36
+ <DemoIcon
37
+ assistiveText={{ label: 'Log a Call' }}
38
+ category="standard"
39
+ name="log_a_call"
40
+ style={{ backgroundColor: 'rgb(218, 165, 32)' }}
41
+ size="large"
42
+ />
43
+ </IconSettings>
44
+ )
45
+ );
46
+
47
+ afterEach(unmountComponent);
48
+
49
+ it('renders container class', function () {
50
+ expect(this.wrapper).to.have.className('slds-icon_container');
51
+ });
52
+
53
+ it('renders assistive text', function () {
54
+ expect(this.wrapper.find('.slds-assistive-text')).to.have.text(
55
+ 'Log a Call'
56
+ );
57
+ });
58
+
59
+ it('renders icon name class on svg', function () {
60
+ // also tests that all '_' are replaced with '-'
61
+ expect(this.wrapper).to.have.className('slds-icon-standard-log-a-call');
62
+ });
63
+
64
+ it('renders custom background color', function () {
65
+ svg = this.wrapper.find('svg');
66
+ expect(svg).to.have.style('backgroundColor', 'rgb(218, 165, 32)');
67
+ });
68
+
69
+ it('renders icon size class', function () {
70
+ svg = this.wrapper.find('svg');
71
+ expect(svg.hasClass('slds-icon_large')).to.be.true;
72
+ });
73
+ });
74
+
75
+ describe('Custom Icon Props Render', function describeFunction2() {
76
+ let svg;
77
+
78
+ beforeEach(
79
+ mountComponent(
80
+ <IconSettings iconPath="/assets/icons">
81
+ <DemoIcon
82
+ assistiveText={{ label: 'Heart' }}
83
+ category="custom"
84
+ name="custom1"
85
+ size="small"
86
+ />
87
+ </IconSettings>
88
+ )
89
+ );
90
+
91
+ afterEach(unmountComponent);
92
+
93
+ it('renders container class', function () {
94
+ expect(this.wrapper).to.have.className('slds-icon_container');
95
+ });
96
+
97
+ it('renders assistive text', function () {
98
+ expect(this.wrapper.find('.slds-assistive-text')).to.have.text('Heart');
99
+ });
100
+
101
+ it('renders icon name class on svg', function () {
102
+ // also tests that all '_' are replaced with '-'
103
+ expect(this.wrapper).to.have.className('slds-icon-custom-custom1');
104
+ });
105
+
106
+ it('renders icon size class', function () {
107
+ svg = this.wrapper.find('svg');
108
+ expect(svg.hasClass('slds-icon_small')).to.be.true;
109
+ });
110
+ });
111
+
112
+ describe('Action Icon Props Render', function describeFunction() {
113
+ let svg;
114
+
115
+ beforeEach(
116
+ mountComponent(
117
+ <IconSettings iconPath="/assets/icons">
118
+ <DemoIcon
119
+ assistiveText={{ label: 'Announcements' }}
120
+ category="action"
121
+ name="announcement"
122
+ size="large"
123
+ title="custom title"
124
+ className="slds-m-around_x-small"
125
+ />
126
+ </IconSettings>
127
+ )
128
+ );
129
+
130
+ afterEach(unmountComponent);
131
+
132
+ it('renders container class', function () {
133
+ expect(this.wrapper).to.have.className('slds-icon_container');
134
+ });
135
+
136
+ it('renders assistive text', function () {
137
+ expect(this.wrapper.find('.slds-assistive-text')).to.have.text(
138
+ 'Announcements'
139
+ );
140
+ });
141
+
142
+ it('renders round container', function () {
143
+ expect(this.wrapper).to.have.className('slds-icon_container_circle');
144
+ });
145
+
146
+ it('renders icon name class on svg', function () {
147
+ // also tests that all '_' are replaced with '-'
148
+ expect(this.wrapper).to.have.className('slds-icon-action-announcement');
149
+ });
150
+
151
+ it('renders icon size class', function () {
152
+ svg = this.wrapper.find('svg');
153
+ expect(svg.hasClass('slds-icon_large')).to.be.true;
154
+ });
155
+
156
+ it('renders title', function () {
157
+ expect(this.wrapper.find('[title="custom title"]')).to.exist;
158
+ });
159
+ });
160
+
161
+ describe('Utility Icon Props Render', function describeFunction() {
162
+ beforeEach(
163
+ mountComponent(
164
+ <IconSettings iconPath="/assets/icons">
165
+ <DemoIcon category="utility" name="open_folder" size="medium" />
166
+ </IconSettings>
167
+ )
168
+ );
169
+
170
+ afterEach(unmountComponent);
171
+
172
+ it('does NOT render container class', function () {
173
+ expect(this.wrapper.hasClass('slds-icon_container')).to.be.false;
174
+ });
175
+
176
+ it('medium size does not render size class', function () {
177
+ // also tests that all '_' are replaced with '-'
178
+ expect(this.wrapper.hasClass('slds-icon_medium')).to.be.false;
179
+ });
180
+
181
+ it('utility icons do not render name class on svg', function () {
182
+ // also tests that all '_' are replaced with '-'
183
+ expect(this.wrapper.hasClass('slds-icon-text-default')).to.be.false;
184
+ });
185
+ });
186
+
187
+ describe('Icon with external path renders', function describeFunction() {
188
+ beforeEach(
189
+ mountComponent(
190
+ <IconSettings iconPath="/assets/icons">
191
+ <DemoIcon
192
+ assistiveText={{ label: 'New stuff!' }}
193
+ inverse
194
+ path="/assets/icons/utility-sprite/svg/symbols.svg#announcement"
195
+ size="medium"
196
+ />
197
+ </IconSettings>
198
+ )
199
+ );
200
+
201
+ afterEach(unmountComponent);
202
+
203
+ it('does NOT render slds-icon-standard class', function () {
204
+ expect(this.wrapper.hasClass('slds-icon-standard-')).to.be.false;
205
+ });
206
+
207
+ it('path prop is passed to svg', function () {
208
+ expect(this.wrapper.find('use')).to.have.attr(
209
+ 'href',
210
+ '/assets/icons/utility-sprite/svg/symbols.svg#announcement'
211
+ );
212
+ });
213
+ });
214
+ });
@@ -0,0 +1,177 @@
1
+ /* eslint-env mocha */
2
+ /* eslint-disable prefer-arrow-callback */
3
+ /* eslint-disable no-unused-expressions */
4
+ /* eslint-disable no-unused-vars */
5
+ /* global sinon */
6
+
7
+ import React from 'react';
8
+
9
+ import chai, { expect } from 'chai';
10
+ import chaiEnzyme from 'chai-enzyme';
11
+ // `this.wrapper` and `this.dom` is set in the helpers file
12
+ import {
13
+ mountComponent,
14
+ unmountComponent,
15
+ } from '../../../tests/enzyme-helpers';
16
+
17
+ import Illustration from '../../illustration';
18
+
19
+ chai.use(chaiEnzyme());
20
+
21
+ class DemoIllustration extends React.Component {
22
+ static displayName = 'DemoIllustration';
23
+
24
+ render() {
25
+ return <Illustration {...this.props} silenceDeprecationWarning />;
26
+ }
27
+ }
28
+
29
+ describe('SLDSIllustration: ', function describeFunction() {
30
+ describe('Image with heading and message render', function describeFunction2() {
31
+ let svg;
32
+ let heading;
33
+ let messageBody;
34
+
35
+ beforeEach(
36
+ mountComponent(
37
+ <DemoIllustration
38
+ className="custom-illustration"
39
+ internalIllustration
40
+ heading="Lorem ipsum dolor"
41
+ messageBody="Lorem ipsum dolor sit amet, consectetur"
42
+ name="No Access"
43
+ path="/assets/images/illustrations/empty-state-no-access.svg#no-access"
44
+ size="small"
45
+ style={{ backgroundColor: 'rgb(218, 165, 32)' }}
46
+ />
47
+ )
48
+ );
49
+
50
+ afterEach(unmountComponent);
51
+
52
+ it('renders container class', function () {
53
+ expect(this.wrapper).to.have.className('slds-illustration');
54
+ expect(this.wrapper).to.have.className('custom-illustration');
55
+ });
56
+ it('renders illustration size class', function () {
57
+ expect(this.wrapper).to.have.className('slds-illustration_small');
58
+ });
59
+ it('sets svg aria-hidden to true', function () {
60
+ svg = this.wrapper.find('svg');
61
+ expect(svg).to.have.attr('aria-hidden', 'true');
62
+ });
63
+ it('renders illustration svg class', function () {
64
+ svg = this.wrapper.find('svg');
65
+ expect(svg.hasClass('slds-illustration__svg')).to.be.true; // chai-enzyme is buggy with an svg
66
+ });
67
+ it('renders svg name attribute', function () {
68
+ svg = this.wrapper.find('svg');
69
+ // also tests that all '_' and ' ' are replaced with '-'
70
+ expect(svg).to.have.attr('name', 'no-access');
71
+ });
72
+ it('renders svg custom background color', function () {
73
+ svg = this.wrapper.find('svg');
74
+ expect(svg).to.have.style('backgroundColor', 'rgb(218, 165, 32)');
75
+ });
76
+ it('renders heading', function () {
77
+ heading = this.wrapper.find('.slds-text-heading_medium');
78
+ expect(heading.text()).to.equal('Lorem ipsum dolor');
79
+ });
80
+ it('renders message body', function () {
81
+ messageBody = this.wrapper.find('.slds-text-body_regular');
82
+ expect(messageBody.text()).to.equal(
83
+ 'Lorem ipsum dolor sit amet, consectetur'
84
+ );
85
+ });
86
+ });
87
+
88
+ describe('Heading and message render', function describeFunction2() {
89
+ let svg;
90
+ let heading;
91
+ let messageBody;
92
+
93
+ beforeEach(
94
+ mountComponent(
95
+ <DemoIllustration
96
+ internalIllustration
97
+ heading="Lorem ipsum dolor"
98
+ messageBody="Lorem ipsum dolor sit amet, consectetur"
99
+ />
100
+ )
101
+ );
102
+
103
+ afterEach(unmountComponent);
104
+
105
+ it('does not render svg', function () {
106
+ svg = this.wrapper.find('svg');
107
+ expect(svg).not.to.be.present();
108
+ });
109
+ it('renders heading', function () {
110
+ heading = this.wrapper.find('.slds-text-heading_medium');
111
+ expect(heading.text()).to.equal('Lorem ipsum dolor');
112
+ });
113
+ it('renders message body', function () {
114
+ messageBody = this.wrapper.find('.slds-text-body_regular');
115
+ expect(messageBody.text()).to.equal(
116
+ 'Lorem ipsum dolor sit amet, consectetur'
117
+ );
118
+ });
119
+ });
120
+
121
+ describe('Heading only renders', function describeFunction2() {
122
+ let svg;
123
+ let heading;
124
+
125
+ beforeEach(
126
+ mountComponent(
127
+ <DemoIllustration internalIllustration heading="Lorem ipsum dolor" />
128
+ )
129
+ );
130
+
131
+ afterEach(unmountComponent);
132
+
133
+ it('does not render svg', function () {
134
+ svg = this.wrapper.find('svg');
135
+ expect(svg).not.to.be.present();
136
+ });
137
+ it('renders heading', function () {
138
+ heading = this.wrapper.find('.slds-text-heading_medium');
139
+ expect(heading.text()).to.equal('Lorem ipsum dolor');
140
+ });
141
+ it('does not render message body', function () {
142
+ expect(this.wrapper.find('.slds-text-body_regular')).not.to.be.present();
143
+ });
144
+ });
145
+
146
+ describe('Message only renders', function () {
147
+ let svg;
148
+ let heading;
149
+ let messageBody;
150
+
151
+ beforeEach(
152
+ mountComponent(
153
+ <DemoIllustration
154
+ internalIllustration
155
+ messageBody="Lorem ipsum dolor sit amet, consectetur"
156
+ />
157
+ )
158
+ );
159
+
160
+ afterEach(unmountComponent);
161
+
162
+ it('does not render svg', function () {
163
+ svg = this.wrapper.find('svg');
164
+ expect(svg).not.to.be.present();
165
+ });
166
+ it('does not render heading', function () {
167
+ heading = this.wrapper.find('.slds-text-heading_medium');
168
+ expect(heading).not.to.be.present();
169
+ });
170
+ it('renders message body', function () {
171
+ messageBody = this.wrapper.find('.slds-text-body_regular');
172
+ expect(messageBody.text()).to.equal(
173
+ 'Lorem ipsum dolor sit amet, consectetur'
174
+ );
175
+ });
176
+ });
177
+ });