Skip to content

Commit de9fb49

Browse files
committed
Rename linewrap to wordwrap in Preferences component and update related tests
1 parent c678a4a commit de9fb49

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -442,45 +442,43 @@ describe('<Preferences />', () => {
442442
);
443443
});
444444
});
445+
describe('start wordwrap at false', () => {
446+
it('wordwrap toggle, starting at false', () => {
447+
// render the component with wordwrap prop set to false
448+
subject({ wordwrap: false });
445449

446-
describe('start linewrap at false', () => {
447-
it('linewrap toggle, starting at false', () => {
448-
// render the component with linewrap prop set to false
449-
subject({ linewrap: false });
450-
451-
// get ahold of the radio buttons for toggling linewrap
452-
const linewrapRadioFalse = screen.getByRole('radio', {
453-
name: /linewrap off/i
450+
// get ahold of the radio buttons for toggling wordwrap
451+
const wordwrapRadioFalse = screen.getByRole('radio', {
452+
name: /wordwrap off/i
454453
});
455-
const linewrapRadioTrue = screen.getByRole('radio', {
456-
name: /linewrap on/i
454+
const wordwrapRadioTrue = screen.getByRole('radio', {
455+
name: /wordwrap on/i
457456
});
458457

459458
testToggle(
460-
linewrapRadioFalse,
461-
linewrapRadioTrue,
459+
wordwrapRadioFalse,
460+
wordwrapRadioTrue,
462461
props.setLinewrap,
463462
true
464463
);
465464
});
466465
});
466+
describe('start wordwrap at true', () => {
467+
it('wordwrap toggle, starting at true', () => {
468+
// render the component with wordwrap prop set to true
469+
subject({ wordwrap: true });
467470

468-
describe('start linewrap at true', () => {
469-
it('linewrap toggle, starting at true', () => {
470-
// render the component with linewrap prop set to false
471-
subject({ linewrap: true });
472-
473-
// get ahold of the radio buttons for toggling linewrap
474-
const linewrapRadioFalse = screen.getByRole('radio', {
475-
name: /linewrap off/i
471+
// get ahold of the radio buttons for toggling wordwrap
472+
const wordwrapRadioFalse = screen.getByRole('radio', {
473+
name: /wordwrap off/i
476474
});
477-
const linewrapRadioTrue = screen.getByRole('radio', {
478-
name: /linewrap on/i
475+
const wordwrapRadioTrue = screen.getByRole('radio', {
476+
name: /wordwrap on/i
479477
});
480478

481479
testToggle(
482-
linewrapRadioTrue,
483-
linewrapRadioFalse,
480+
wordwrapRadioTrue,
481+
wordwrapRadioFalse,
484482
props.setLinewrap,
485483
false
486484
);
@@ -513,7 +511,7 @@ describe('<Preferences />', () => {
513511
});
514512

515513
const generalElement1 = screen.getByRole('radio', {
516-
name: /linewrap on/i
514+
name: /wordwrap on/i
517515
});
518516
expect(generalElement1).toBeInTheDocument();
519517
});

client/modules/IDE/components/Preferences/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function Preferences() {
3838
tabIndex,
3939
fontSize,
4040
autosave,
41-
linewrap,
41+
wordwrap,
4242
lineNumbers,
4343
lintWarning,
4444
textOutput,
@@ -387,26 +387,26 @@ export default function Preferences() {
387387
type="radio"
388388
onChange={() => dispatch(setLinewrap(true))}
389389
aria-label={t('Preferences.WordWrapOnARIA')}
390-
name="linewrap"
391-
id="linewrap-on"
390+
name="wordwrap"
391+
id="wordwrap-on"
392392
className="preference__radio-button"
393393
value="On"
394-
checked={linewrap}
394+
checked={wordwrap}
395395
/>
396-
<label htmlFor="linewrap-on" className="preference__option">
396+
<label htmlFor="wordwrap-on" className="preference__option">
397397
{t('Preferences.On')}
398398
</label>
399399
<input
400400
type="radio"
401401
onChange={() => dispatch(setLinewrap(false))}
402402
aria-label={t('Preferences.WordWrapOffARIA')}
403-
name="linewrap"
404-
id="linewrap-off"
403+
name="wordwrap"
404+
id="wordwrap-off"
405405
className="preference__radio-button"
406406
value="Off"
407-
checked={!linewrap}
407+
checked={!wordwrap}
408408
/>
409-
<label htmlFor="linewrap-off" className="preference__option">
409+
<label htmlFor="wordwrap-off" className="preference__option">
410410
{t('Preferences.Off')}
411411
</label>
412412
</fieldset>

0 commit comments

Comments
 (0)