Skip to content

Commit d452f20

Browse files
committed
Remove act around subject.
1 parent d7a3834 commit d452f20

File tree

1 file changed

+36
-91
lines changed

1 file changed

+36
-91
lines changed

client/modules/IDE/components/Preferences/Preferences.unit.test.jsx

Lines changed: 36 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ describe('<Preferences />', () => {
2626
describe('font tests', () => {
2727
it('font size increase button says increase', () => {
2828
// render the component
29-
act(() => {
30-
subject({ fontSize: 12 });
31-
});
29+
subject({ fontSize: 12 });
3230

3331
// get ahold of the button for increasing text size
3432
const fontPlusButton = screen.getByRole('button', {
@@ -41,9 +39,7 @@ describe('<Preferences />', () => {
4139

4240
it('increase font size by 2 when clicking plus button', () => {
4341
// render the component with font size set to 12
44-
act(() => {
45-
subject({ fontSize: 12 });
46-
});
42+
subject({ fontSize: 12 });
4743

4844
// get ahold of the button for increasing text size
4945
const fontPlusButton = screen.getByRole('button', {
@@ -62,9 +58,7 @@ describe('<Preferences />', () => {
6258

6359
it('font size decrease button says decrease', () => {
6460
// render the component with font size set to 12
65-
act(() => {
66-
subject({ fontSize: 12 });
67-
});
61+
subject({ fontSize: 12 });
6862

6963
// get ahold of the button for decreasing font size
7064
const fontPlusButton = screen.getByRole('button', {
@@ -77,9 +71,7 @@ describe('<Preferences />', () => {
7771

7872
it('decrease font size by 2 when clicking minus button', () => {
7973
// render the component with font size set to 12
80-
act(() => {
81-
subject({ fontSize: 12 });
82-
});
74+
subject({ fontSize: 12 });
8375

8476
// get ahold of the button for decreasing text size
8577
const fontMinusButton = screen.getByRole('button', {
@@ -98,9 +90,7 @@ describe('<Preferences />', () => {
9890

9991
it('font text field changes on manual text input', () => {
10092
// render the component with font size set to 12
101-
act(() => {
102-
subject({ fontSize: 12 });
103-
});
93+
subject({ fontSize: 12 });
10494

10595
// get ahold of the text field
10696
const input = screen.getByRole('textbox', { name: /font size/i });
@@ -126,9 +116,7 @@ describe('<Preferences />', () => {
126116

127117
it('font size CAN NOT go over 36', () => {
128118
// render the component
129-
act(() => {
130-
subject({ fontSize: 12 });
131-
});
119+
subject({ fontSize: 12 });
132120

133121
// get ahold of the text field
134122
const input = screen.getByRole('textbox', { name: /font size/i });
@@ -153,9 +141,7 @@ describe('<Preferences />', () => {
153141

154142
it('font size CAN NOT go under 8', () => {
155143
// render the component
156-
act(() => {
157-
subject({ fontSize: 12 });
158-
});
144+
subject({ fontSize: 12 });
159145

160146
// get ahold of the text field
161147
const input = screen.getByRole('textbox', { name: /font size/i });
@@ -182,9 +168,7 @@ describe('<Preferences />', () => {
182168
// h and then i, but it tests the same idea
183169
it('font size input field does NOT take non-integers', () => {
184170
// render the component
185-
act(() => {
186-
subject({ fontSize: 12 });
187-
});
171+
subject({ fontSize: 12 });
188172

189173
// get ahold of the text field
190174
const input = screen.getByRole('textbox', { name: /font size/i });
@@ -212,9 +196,7 @@ describe('<Preferences />', () => {
212196

213197
it('font size input field does NOT take "-"', () => {
214198
// render the component
215-
act(() => {
216-
subject({ fontSize: 12 });
217-
});
199+
subject({ fontSize: 12 });
218200

219201
// get ahold of the text field
220202
const input = screen.getByRole('textbox', { name: /font size/i });
@@ -272,9 +254,7 @@ describe('<Preferences />', () => {
272254
describe('testing theme switching', () => {
273255
describe('dark mode', () => {
274256
it('switch to light', () => {
275-
act(() => {
276-
subject({ theme: 'dark' });
277-
});
257+
subject({ theme: 'dark' });
278258

279259
const themeRadioCurrent = screen.getByRole('radio', {
280260
name: /dark theme on/i
@@ -295,9 +275,7 @@ describe('<Preferences />', () => {
295275

296276
describe('light mode', () => {
297277
it('switch to dark', () => {
298-
act(() => {
299-
subject({ theme: 'light' });
300-
});
278+
subject({ theme: 'light' });
301279

302280
const themeRadioCurrent = screen.getByRole('radio', {
303281
name: /light theme on/i
@@ -316,9 +294,8 @@ describe('<Preferences />', () => {
316294
});
317295

318296
it('switch to contrast', () => {
319-
act(() => {
320-
subject({ theme: 'light' });
321-
});
297+
subject({ theme: 'light' });
298+
322299
const themeRadioCurrent = screen.getByRole('radio', {
323300
name: /light theme on/i
324301
});
@@ -339,9 +316,7 @@ describe('<Preferences />', () => {
339316

340317
describe('testing toggle UI elements on starting tab', () => {
341318
it('autosave toggle, starting at false', () => {
342-
act(() => {
343-
subject({ autosave: false });
344-
});
319+
subject({ autosave: false });
345320

346321
// get ahold of the radio buttons for toggling autosave
347322
const autosaveRadioFalse = screen.getByRole('radio', {
@@ -361,9 +336,7 @@ describe('<Preferences />', () => {
361336

362337
it('autocloseBracketsQuotes toggle, starting at false', () => {
363338
// render the component with autocloseBracketsQuotes prop set to false
364-
act(() => {
365-
subject({ autocloseBracketsQuotes: false });
366-
});
339+
subject({ autocloseBracketsQuotes: false });
367340

368341
// get ahold of the radio buttons for toggling autocloseBracketsQuotes
369342
const autocloseRadioFalse = screen.getByRole('radio', {
@@ -383,9 +356,7 @@ describe('<Preferences />', () => {
383356

384357
it('autocompleteHinter toggle, starting at false', () => {
385358
// render the component with autocompleteHinter prop set to false
386-
act(() => {
387-
subject({ autocompleteHinter: false });
388-
});
359+
subject({ autocompleteHinter: false });
389360

390361
// get ahold of the radio buttons for toggling autocompleteHinter
391362
const autocompleteRadioFalse = screen.getByRole('radio', {
@@ -406,9 +377,7 @@ describe('<Preferences />', () => {
406377
describe('start autosave value at true', () => {
407378
it('autosave toggle, starting at true', () => {
408379
// render the component with autosave prop set to true
409-
act(() => {
410-
subject({ autosave: true });
411-
});
380+
subject({ autosave: true });
412381

413382
// get ahold of the radio buttons for toggling autosave
414383
const autosaveRadioFalse = screen.getByRole('radio', {
@@ -429,9 +398,7 @@ describe('<Preferences />', () => {
429398

430399
describe('start autoclose brackets value at true', () => {
431400
it('autocloseBracketsQuotes toggle, starting at true', () => {
432-
act(() => {
433-
subject({ autocloseBracketsQuotes: true });
434-
});
401+
subject({ autocloseBracketsQuotes: true });
435402

436403
// get ahold of the radio buttons for toggling autocloseBracketsQuotes
437404
const autocloseRadioFalse = screen.getByRole('radio', {
@@ -453,9 +420,7 @@ describe('<Preferences />', () => {
453420
describe('start autocomplete hinter value at true', () => {
454421
it('autocompleteHinter toggle, starting at true', () => {
455422
// render the component with autocompleteHinter prop set to true
456-
act(() => {
457-
subject({ autocompleteHinter: true });
458-
});
423+
subject({ autocompleteHinter: true });
459424

460425
// get ahold of the radio buttons for toggling autocompleteHinter
461426
const autocompleteRadioFalse = screen.getByRole('radio', {
@@ -477,9 +442,7 @@ describe('<Preferences />', () => {
477442
describe('start linewrap at false', () => {
478443
it('linewrap toggle, starting at false', () => {
479444
// render the component with linewrap prop set to false
480-
act(() => {
481-
subject({ linewrap: false });
482-
});
445+
subject({ linewrap: false });
483446

484447
// get ahold of the radio buttons for toggling linewrap
485448
const linewrapRadioFalse = screen.getByRole('radio', {
@@ -501,9 +464,7 @@ describe('<Preferences />', () => {
501464
describe('start linewrap at true', () => {
502465
it('linewrap toggle, starting at true', () => {
503466
// render the component with linewrap prop set to false
504-
act(() => {
505-
subject({ linewrap: true });
506-
});
467+
subject({ linewrap: true });
507468

508469
// get ahold of the radio buttons for toggling linewrap
509470
const linewrapRadioFalse = screen.getByRole('radio', {
@@ -526,9 +487,7 @@ describe('<Preferences />', () => {
526487
describe('can toggle between general settings and accessibility tabs successfully', () => {
527488
it('can toggle sucessfully', () => {
528489
// render the component with lineNumbers prop set to false
529-
act(() => {
530-
subject({ lineNumbers: false });
531-
});
490+
subject({ lineNumbers: false });
532491

533492
// switch to accessibility
534493
act(() => {
@@ -560,9 +519,7 @@ describe('<Preferences />', () => {
560519
describe('starting linenumbers at false', () => {
561520
it('lineNumbers toggle, starting at false', () => {
562521
// render the component with lineNumbers prop set to false
563-
act(() => {
564-
subject({ lineNumbers: false });
565-
});
522+
subject({ lineNumbers: false });
566523

567524
// switch tabs
568525
act(() => {
@@ -591,9 +548,7 @@ describe('<Preferences />', () => {
591548
describe('starting linenumbers at true', () => {
592549
it('lineNumbers toggle, starting at true', () => {
593550
// render the component with lineNumbers prop set to false
594-
act(() => {
595-
subject({ lineNumbers: true });
596-
});
551+
subject({ lineNumbers: true });
597552

598553
// switch tabs
599554
act(() => {
@@ -622,9 +577,7 @@ describe('<Preferences />', () => {
622577
describe('starting lintWarning at false', () => {
623578
it('lintWarning toggle, starting at false', () => {
624579
// render the component with lintWarning prop set to false
625-
act(() => {
626-
subject({ lintWarning: false });
627-
});
580+
subject({ lintWarning: false });
628581

629582
// switch tabs
630583
act(() => {
@@ -653,9 +606,7 @@ describe('<Preferences />', () => {
653606
describe('starting lintWarning at true', () => {
654607
it('lintWarning toggle, starting at true', () => {
655608
// render the component with lintWarning prop set to false
656-
act(() => {
657-
subject({ lintWarning: true });
658-
});
609+
subject({ lintWarning: true });
659610

660611
// switch tabs
661612
act(() => {
@@ -682,12 +633,10 @@ describe('<Preferences />', () => {
682633
});
683634

684635
const testCheckbox = (arialabel, startState, setter) => {
685-
act(() => {
686-
subject({
687-
textOutput: startState && arialabel === 'text output on',
688-
soundOutput: startState && arialabel === 'sound output on',
689-
gridOutput: startState && arialabel === 'table output on'
690-
});
636+
subject({
637+
textOutput: startState && arialabel === 'text output on',
638+
soundOutput: startState && arialabel === 'sound output on',
639+
gridOutput: startState && arialabel === 'table output on'
691640
});
692641

693642
// switch tabs
@@ -731,11 +680,9 @@ describe('<Preferences />', () => {
731680

732681
describe('multiple checkboxes can be selected', () => {
733682
it('multiple checkboxes can be selected', () => {
734-
act(() => {
735-
subject({
736-
textOutput: true,
737-
gridOutput: true
738-
});
683+
subject({
684+
textOutput: true,
685+
gridOutput: true
739686
});
740687

741688
// switch tabs
@@ -759,11 +706,9 @@ describe('<Preferences />', () => {
759706

760707
describe('none of the checkboxes can be selected', () => {
761708
it('none of the checkboxes can be selected', () => {
762-
act(() => {
763-
subject({
764-
textOutput: false,
765-
gridOutput: false
766-
});
709+
subject({
710+
textOutput: false,
711+
gridOutput: false
767712
});
768713

769714
// switch tabs

0 commit comments

Comments
 (0)