@salesforce/design-system-react 0.10.50-alpha.1 → 0.10.50-alpha.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 (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,612 @@
1
+ /* eslint-disable max-lines */
2
+ /* eslint-disable react/no-render-return-value */
3
+ import React from 'react';
4
+ import ReactDOM from 'react-dom';
5
+ import { expect } from 'chai';
6
+ import assign from 'lodash.assign';
7
+ import TestUtils from 'react-dom/test-utils';
8
+
9
+ import Input from '../../input';
10
+ import Icon from '../../icon';
11
+ import InputIcon from '../../icon/input-icon';
12
+ import IconSettings from '../../icon-settings';
13
+
14
+ describe('SLDSInput', () => {
15
+ const defaultProps = {
16
+ placeholder: 'Placeholder Text',
17
+ };
18
+
19
+ let body;
20
+
21
+ const renderInput = (instance) => {
22
+ body = document.createElement('div');
23
+ document.body.appendChild(body);
24
+ /* deepscan-disable REACT_ASYNC_RENDER_RETURN_VALUE */
25
+ return ReactDOM.render(
26
+ <div>
27
+ <IconSettings iconPath="/assets/icons">{instance}</IconSettings>
28
+ </div>,
29
+ body
30
+ );
31
+ /* deepscan-enable REACT_ASYNC_RENDER_RETURN_VALUE */
32
+ };
33
+
34
+ function removeInput() {
35
+ ReactDOM.unmountComponentAtNode(body);
36
+ document.body.removeChild(body);
37
+ }
38
+
39
+ const createInput = (props) =>
40
+ React.createElement(Input, assign({}, defaultProps, props));
41
+ const getInput = (props) => renderInput(createInput(props));
42
+
43
+ describe('Standard Input with Label', () => {
44
+ let component;
45
+ let wrapper;
46
+ let input;
47
+ let label;
48
+
49
+ beforeEach(() => {
50
+ component = getInput({ label: 'Input Label', id: 'custom-id' });
51
+ [wrapper] = component.getElementsByClassName('slds-form-element');
52
+ [input] = component.getElementsByTagName('input');
53
+ [label] = component.getElementsByClassName('slds-form-element__label');
54
+ });
55
+
56
+ afterEach(() => {
57
+ removeInput();
58
+ });
59
+
60
+ it('is wrapped in div with class "slds-form-element"', () => {
61
+ expect(wrapper.className).to.include('slds-form-element');
62
+ });
63
+
64
+ it('renders label', () => {
65
+ expect(label.textContent).to.equal('Input Label');
66
+ });
67
+
68
+ it('renders input element with class "slds-input"', () => {
69
+ expect(input.className).to.include('slds-input');
70
+ });
71
+
72
+ it('has an id', () => {
73
+ expect(input.getAttribute('id')).to.be.ok;
74
+ });
75
+
76
+ it('can pass custom id', () => {
77
+ expect(input.getAttribute('id')).to.equal('custom-id');
78
+ });
79
+
80
+ it('renders placeholder text', () => {
81
+ expect(input.getAttribute('placeholder')).to.equal('Placeholder Text');
82
+ });
83
+
84
+ it('has associated label for tag pointing to id of input', () => {
85
+ const labelForTag = label.getAttribute('for');
86
+ const inputId = input.getAttribute('id');
87
+ expect(labelForTag).to.equal(inputId);
88
+ });
89
+ });
90
+
91
+ describe('Input without Assistive Text Label', () => {
92
+ let component;
93
+ let label;
94
+ let input;
95
+
96
+ beforeEach(() => {
97
+ component = getInput({ assistiveText: { label: 'Assistive Label' } });
98
+ [input] = component.getElementsByTagName('input');
99
+ [label] = component.getElementsByClassName('slds-form-element__label');
100
+ });
101
+
102
+ afterEach(() => {
103
+ removeInput();
104
+ });
105
+
106
+ it('renders label (assitive)', () => {
107
+ expect(label.textContent).to.equal('Assistive Label');
108
+ });
109
+
110
+ it('label has class "slds-assistive-text"', () => {
111
+ expect(label.className).to.include('slds-assistive-text');
112
+ });
113
+
114
+ it('has associated label for tag pointing to id of input', () => {
115
+ const labelForTag = label.getAttribute('for');
116
+ const inputId = input.getAttribute('id');
117
+ expect(labelForTag).to.equal(inputId);
118
+ });
119
+ });
120
+
121
+ describe('Read Only Input', () => {
122
+ let component;
123
+ let label;
124
+ let input;
125
+
126
+ beforeEach(() => {
127
+ component = getInput({ label: 'Input Label', readOnly: true });
128
+ [input] = component.getElementsByTagName('input');
129
+ [label] = component.getElementsByTagName('label');
130
+ });
131
+
132
+ afterEach(() => {
133
+ removeInput();
134
+ });
135
+
136
+ it('label has class "slds-form-element__label"', () => {
137
+ expect(label.className).to.include('slds-form-element__label');
138
+ });
139
+
140
+ it('input has attribute "readonly"', () => {
141
+ expect(input.getAttribute('readonly')).to.equal('');
142
+ });
143
+ });
144
+
145
+ describe('Static Input', () => {
146
+ let component;
147
+ let label;
148
+ let input;
149
+
150
+ beforeEach(() => {
151
+ component = getInput({ label: 'Input Label', isStatic: true });
152
+ [label] = component.getElementsByTagName('span');
153
+ // eslint-disable-next-line prefer-destructuring
154
+ input = component.getElementsByTagName('span')[1];
155
+ });
156
+
157
+ afterEach(() => {
158
+ removeInput();
159
+ });
160
+
161
+ it('label is a span and has class "slds-form-element__label"', () => {
162
+ expect(label.className).to.include('slds-form-element__label');
163
+ });
164
+
165
+ it('input is a span and has class "slds-form-element__static"', () => {
166
+ expect(input.className).to.include('slds-form-element__static');
167
+ });
168
+ });
169
+
170
+ describe('Disabled Input', () => {
171
+ let component;
172
+ let input;
173
+
174
+ beforeEach(() => {
175
+ component = getInput({ label: 'Input Label', disabled: true });
176
+ [input] = component.getElementsByTagName('input');
177
+ });
178
+
179
+ afterEach(() => {
180
+ removeInput();
181
+ });
182
+
183
+ it('input has attribute "disabled"', () => {
184
+ expect(input.getAttribute('disabled')).to.equal('');
185
+ });
186
+ });
187
+
188
+ describe('Multiple Inputs', () => {
189
+ let component1;
190
+ let component2;
191
+ let input1;
192
+ let input2;
193
+
194
+ beforeEach(() => {
195
+ component1 = getInput({
196
+ className: 'input-one',
197
+ label: 'Input One',
198
+ });
199
+ component2 = getInput({ className: 'input-two', label: 'Input Two' });
200
+ [input1] = component1.getElementsByTagName('input');
201
+ [input2] = component2.getElementsByTagName('input');
202
+ });
203
+
204
+ afterEach(() => {
205
+ const inputNodes = document.querySelectorAll('.slds-form-element');
206
+ inputNodes[0].parentNode.remove(inputNodes[0]);
207
+ inputNodes[1].parentNode.remove(inputNodes[1]);
208
+ });
209
+
210
+ it('each input has unique generated id', () => {
211
+ expect(input1.getAttribute('id')).to.not.equal(input2.getAttribute('id'));
212
+ });
213
+ });
214
+
215
+ describe('Required Input in Error State', () => {
216
+ let component;
217
+ let wrapper;
218
+ let error;
219
+ let input;
220
+
221
+ beforeEach(() => {
222
+ component = getInput({
223
+ label: 'Input Label',
224
+ required: true,
225
+ errorText: 'Error Message',
226
+ });
227
+
228
+ [wrapper] = component.getElementsByClassName('slds-form-element');
229
+ [input] = component.getElementsByTagName('input');
230
+ [error] = component.getElementsByClassName('slds-form-element__help');
231
+ });
232
+
233
+ afterEach(() => {
234
+ removeInput();
235
+ });
236
+
237
+ it('input wrapper contains an <abbr> that has class "slds-required"', () => {
238
+ expect(component.getElementsByTagName('abbr')[0].className).to.include(
239
+ 'slds-required'
240
+ );
241
+ });
242
+
243
+ it('input wrapper has class "slds-has-error"', () => {
244
+ expect(wrapper.className).to.include('slds-has-error');
245
+ });
246
+
247
+ it('renders error message', () => {
248
+ expect(error.textContent).to.equal('Error Message');
249
+ });
250
+
251
+ it('has associated aria-describedby pointing to id of error message', () => {
252
+ const inputDescribedby = input.getAttribute('aria-describedby');
253
+ const errorId = error.getAttribute('id');
254
+ expect(inputDescribedby).to.equal(errorId);
255
+ });
256
+ });
257
+
258
+ describe('Input with Left Clickable Icon', () => {
259
+ let component;
260
+ let elementControl;
261
+ let leftButton;
262
+ let iconAssistiveText;
263
+
264
+ const clickCallback = sinon.spy();
265
+
266
+ beforeEach(() => {
267
+ component = getInput({
268
+ iconLeft: (
269
+ <InputIcon
270
+ assistiveText={{ icon: 'Passed assistive text to icon' }}
271
+ name="search"
272
+ category="utility"
273
+ onClick={clickCallback}
274
+ />
275
+ ),
276
+ });
277
+ [leftButton] = component.getElementsByTagName('button');
278
+ [iconAssistiveText] = component.getElementsByClassName(
279
+ 'slds-assistive-text'
280
+ );
281
+ [elementControl] = component.getElementsByClassName(
282
+ 'slds-form-element__control'
283
+ );
284
+ });
285
+
286
+ afterEach(() => {
287
+ removeInput();
288
+ });
289
+
290
+ it('element control has class "slds-input-has-icon"', () => {
291
+ expect(elementControl.className).to.include('slds-input-has-icon');
292
+ });
293
+
294
+ it('passes "assitiveText" down to icon', () => {
295
+ expect(iconAssistiveText.textContent).to.equal(
296
+ 'Passed assistive text to icon'
297
+ );
298
+ });
299
+
300
+ it('icon renders button BEFORE input in DOM', () => {
301
+ const render = elementControl.innerHTML;
302
+ expect(render.indexOf('<button')).to.be.below(render.indexOf('<input'));
303
+ });
304
+
305
+ it('icon can be clicked', () => {
306
+ TestUtils.Simulate.click(leftButton);
307
+ expect(clickCallback.calledOnce).to.be.true;
308
+ });
309
+ });
310
+
311
+ describe('Input with Right Clickable Icon', () => {
312
+ let component;
313
+ let elementControl;
314
+ let leftButton;
315
+
316
+ const clickCallback = sinon.spy();
317
+
318
+ beforeEach(() => {
319
+ component = getInput({
320
+ iconRight: (
321
+ <InputIcon
322
+ assistiveText={{ icon: 'Passed assistive text to icon' }}
323
+ name="search"
324
+ category="utility"
325
+ onClick={clickCallback}
326
+ />
327
+ ),
328
+ });
329
+ [leftButton] = component.getElementsByTagName('button');
330
+ [elementControl] = component.getElementsByClassName(
331
+ 'slds-form-element__control'
332
+ );
333
+ });
334
+
335
+ afterEach(() => {
336
+ removeInput();
337
+ });
338
+
339
+ it('element control has class "slds-input-has-icon"', () => {
340
+ expect(elementControl.className).to.include('slds-input-has-icon');
341
+ });
342
+
343
+ it('icon renders button AFTER input in DOM', () => {
344
+ const render = elementControl.innerHTML;
345
+ expect(render.indexOf('<button')).to.be.above(render.indexOf('<input'));
346
+ });
347
+
348
+ it('icon can be clicked', () => {
349
+ TestUtils.Simulate.click(leftButton);
350
+
351
+ expect(clickCallback.calledOnce).to.be.true;
352
+ });
353
+ });
354
+
355
+ describe('Input with Non-Clickable Icon', () => {
356
+ let component;
357
+ let elementControl;
358
+
359
+ beforeEach(() => {
360
+ component = getInput({
361
+ iconRight: <Icon name="search" category="utility" />,
362
+ });
363
+ [elementControl] = component.getElementsByClassName(
364
+ 'slds-form-element__control'
365
+ );
366
+ });
367
+
368
+ afterEach(() => {
369
+ removeInput();
370
+ });
371
+
372
+ it('button tag does not exist', () => {
373
+ expect(elementControl.getElementsByTagName('button')[0]).to.not.be.ok;
374
+ });
375
+ });
376
+
377
+ describe('Input with Loading Spinner Icon', () => {
378
+ let component;
379
+ let spinner;
380
+ let input;
381
+
382
+ beforeEach(() => {
383
+ component = getInput({
384
+ assistiveText: { label: 'Passed assistive text to icon' },
385
+ hasSpinner: true,
386
+ iconRight: (
387
+ <InputIcon
388
+ assistiveText={{ icon: 'Passed assistive text to icon' }}
389
+ name="search"
390
+ category="utility"
391
+ />
392
+ ),
393
+ id: 'unique-id-4',
394
+ label: 'Input Label',
395
+ });
396
+ [spinner] = component.getElementsByClassName('slds-spinner');
397
+ [input] = component.getElementsByTagName('input');
398
+ });
399
+
400
+ afterEach(() => {
401
+ removeInput();
402
+ });
403
+
404
+ it('renders loading spinner icon', () => {
405
+ expect(spinner).to.be.ok;
406
+ });
407
+
408
+ it('input aria-describedby points to id of spinner)', () => {
409
+ const spinnerId = spinner.getAttribute('id');
410
+ const inputDescribedby = input.getAttribute('aria-describedby');
411
+ expect(inputDescribedby).to.include(spinnerId);
412
+ });
413
+
414
+ it('input aria-describedby points to id of spinner AND id of error message)', () => {
415
+ const spinnerId = spinner.getAttribute('id');
416
+ const inputDescribedby = input.getAttribute('aria-describedby');
417
+ expect(inputDescribedby).to.include(spinnerId);
418
+ });
419
+ });
420
+
421
+ describe('Input with Loading Spinner Icon & Error', () => {
422
+ let component;
423
+ let spinner;
424
+ let input;
425
+ let error;
426
+
427
+ beforeEach(() => {
428
+ component = getInput({
429
+ assistiveText: { label: 'Passed assistive text to icon' },
430
+ required: true,
431
+ errorText: 'Error Message',
432
+ hasSpinner: true,
433
+ iconRight: (
434
+ <InputIcon
435
+ assistiveText={{ icon: 'Passed assistive text to icon' }}
436
+ name="search"
437
+ category="utility"
438
+ />
439
+ ),
440
+ id: 'unique-id-4',
441
+ label: 'Input Label',
442
+ });
443
+ [spinner] = component.getElementsByClassName('slds-spinner');
444
+ [input] = component.getElementsByTagName('input');
445
+ [error] = component.getElementsByClassName('slds-form-element__help');
446
+ });
447
+
448
+ afterEach(() => {
449
+ removeInput();
450
+ });
451
+
452
+ it('input aria-describedby points to id of spinner AND id of error message)', () => {
453
+ const errorId = error.getAttribute('id');
454
+ const spinnerId = spinner.getAttribute('id');
455
+ const inputDescribedby = input.getAttribute('aria-describedby');
456
+ expect(inputDescribedby).to.equal(`${spinnerId} ${errorId}`);
457
+ });
458
+ });
459
+
460
+ describe('Input with Fixed Left Text', () => {
461
+ let component;
462
+ let fixedTextLeft;
463
+
464
+ beforeEach(() => {
465
+ component = getInput({
466
+ fixedTextLeft: '$',
467
+ id: 'unique-id-5',
468
+ label: 'Input Label',
469
+ });
470
+ [fixedTextLeft] = component.getElementsByClassName(
471
+ 'slds-form-element__addon'
472
+ );
473
+ });
474
+
475
+ afterEach(() => {
476
+ removeInput();
477
+ });
478
+
479
+ it('renders fixed text node', () => {
480
+ expect(fixedTextLeft).to.be.ok;
481
+ });
482
+
483
+ it('renders fixed text node content', () => {
484
+ expect(fixedTextLeft.textContent).to.equal('$');
485
+ });
486
+ });
487
+
488
+ describe('Counter Input', () => {
489
+ let changeOccurred;
490
+ let component;
491
+ let decrement;
492
+ let increment;
493
+ let onChangeData;
494
+
495
+ afterEach(() => {
496
+ removeInput();
497
+ });
498
+
499
+ it('increments and decrements as expected', () => {
500
+ component = getInput({
501
+ onChange: (event, data) => {
502
+ onChangeData = data;
503
+ },
504
+ value: 1,
505
+ variant: 'counter',
506
+ });
507
+ [decrement] = component.getElementsByClassName(
508
+ 'slds-input__button_decrement'
509
+ );
510
+ [increment] = component.getElementsByClassName(
511
+ 'slds-input__button_increment'
512
+ );
513
+
514
+ onChangeData = {};
515
+ TestUtils.Simulate.mouseDown(increment);
516
+ TestUtils.Simulate.mouseUp(increment);
517
+ expect(onChangeData.number === 2 && onChangeData.value === '2').to.be
518
+ .true;
519
+
520
+ onChangeData = {};
521
+ TestUtils.Simulate.keyDown(increment, {
522
+ key: 'Enter',
523
+ keyCode: 13,
524
+ which: 13,
525
+ });
526
+ TestUtils.Simulate.keyUp(increment, {
527
+ key: 'Enter',
528
+ keyCode: 13,
529
+ which: 13,
530
+ });
531
+ expect(onChangeData.number === 2 && onChangeData.value === '2').to.be
532
+ .true;
533
+
534
+ TestUtils.Simulate.mouseDown(decrement);
535
+ TestUtils.Simulate.mouseUp(decrement);
536
+ expect(onChangeData.number === 0 && onChangeData.value === '0').to.be
537
+ .true;
538
+
539
+ onChangeData = {};
540
+ TestUtils.Simulate.keyDown(decrement, {
541
+ key: 'Enter',
542
+ keyCode: 13,
543
+ which: 13,
544
+ });
545
+ TestUtils.Simulate.keyUp(decrement, {
546
+ key: 'Enter',
547
+ keyCode: 13,
548
+ which: 13,
549
+ });
550
+ expect(onChangeData.number === 0 && onChangeData.value === '0').to.be
551
+ .true;
552
+ });
553
+
554
+ it('respects min and max values', () => {
555
+ component = getInput({
556
+ maxValue: 1,
557
+ minValue: 1,
558
+ onChange: () => {
559
+ changeOccurred = true;
560
+ },
561
+ value: 1,
562
+ variant: 'counter',
563
+ });
564
+ [decrement] = component.getElementsByClassName(
565
+ 'slds-input__button_decrement'
566
+ );
567
+ [increment] = component.getElementsByClassName(
568
+ 'slds-input__button_increment'
569
+ );
570
+
571
+ changeOccurred = false;
572
+ TestUtils.Simulate.mouseDown(increment);
573
+ TestUtils.Simulate.mouseUp(increment);
574
+ expect(changeOccurred).to.be.false;
575
+ expect(increment.disabled).to.be.true;
576
+
577
+ changeOccurred = false;
578
+ TestUtils.Simulate.mouseDown(decrement);
579
+ TestUtils.Simulate.mouseUp(decrement);
580
+ expect(changeOccurred).to.be.false;
581
+ expect(decrement.disabled).to.be.true;
582
+ });
583
+
584
+ it('acknowledges custom step values', () => {
585
+ component = getInput({
586
+ onChange: (event, data) => {
587
+ onChangeData = data;
588
+ },
589
+ step: 0.1,
590
+ value: 1,
591
+ variant: 'counter',
592
+ });
593
+ [decrement] = component.getElementsByClassName(
594
+ 'slds-input__button_decrement'
595
+ );
596
+ [increment] = component.getElementsByClassName(
597
+ 'slds-input__button_increment'
598
+ );
599
+
600
+ onChangeData = {};
601
+ TestUtils.Simulate.mouseDown(increment);
602
+ TestUtils.Simulate.mouseUp(increment);
603
+ expect(onChangeData.number === 1.1 && onChangeData.value === '1.1').to.be
604
+ .true;
605
+
606
+ TestUtils.Simulate.mouseDown(decrement);
607
+ TestUtils.Simulate.mouseUp(decrement);
608
+ expect(onChangeData.number === 0.9 && onChangeData.value === '0.9').to.be
609
+ .true;
610
+ });
611
+ });
612
+ });