Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Code style: Switched to ESLint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed May 17, 2017
1 parent 13086d2 commit 795c5b0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class Heading extends Plugin {
const defaultTitle = t( 'Choose heading' );
const dropdownTooltip = t( 'Heading' );

for ( let option of options ) {
for ( const option of options ) {
const command = editor.commands.get( option.modelElement );
const itemModel = new Model( {
commandName: option.modelElement,
Expand Down Expand Up @@ -93,7 +93,7 @@ export default class Heading extends Plugin {
);

// Register UI component.
editor.ui.componentFactory.add( 'headings', ( locale ) => {
editor.ui.componentFactory.add( 'headings', locale => {
const dropdown = createListDropdown( dropdownModel, locale );

Template.extend( dropdown.template, {
Expand All @@ -105,7 +105,7 @@ export default class Heading extends Plugin {
} );

// Execute command when an item from the dropdown is selected.
this.listenTo( dropdown, 'execute', ( evt ) => {
this.listenTo( dropdown, 'execute', evt => {
editor.execute( evt.source.commandName );
editor.editing.view.focus();
} );
Expand Down
2 changes: 1 addition & 1 deletion src/headingcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class HeadingCommand extends Command {
document.enqueueChanges( () => {
const batch = options.batch || document.batch();

for ( let block of document.selection.getSelectedBlocks() ) {
for ( const block of document.selection.getSelectedBlocks() ) {
// When removing applied option.
if ( shouldRemove ) {
if ( block.is( this.modelElement ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/headingengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class HeadingEngine extends Plugin {
const editing = editor.editing;
const options = editor.config.get( 'heading.options' );

for ( let option of options ) {
for ( const option of options ) {
// Skip paragraph - it is defined in required Paragraph feature.
if ( option.modelElement !== defaultModelElement ) {
// Schema.
Expand Down
6 changes: 3 additions & 3 deletions tests/heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe( 'Heading', () => {
} );

it( 'isEnabled', () => {
for ( let name in commands ) {
for ( const name in commands ) {
commands[ name ].isEnabled = false;
}

Expand All @@ -117,7 +117,7 @@ describe( 'Heading', () => {
} );

it( 'label', () => {
for ( let name in commands ) {
for ( const name in commands ) {
commands[ name ].value = false;
}

Expand Down Expand Up @@ -209,7 +209,7 @@ describe( 'Heading', () => {
toolbar: [ 'heading' ],
lang: 'pl',
heading: {
options: options
options
}
} )
.then( newEditor => {
Expand Down
18 changes: 9 additions & 9 deletions tests/headingcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe( 'HeadingCommand', () => {
editor.commands.set( 'paragraph', new ParagraphCommand( editor ) );
schema.registerItem( 'paragraph', '$block' );

for ( let option of options ) {
for ( const option of options ) {
commands[ option.modelElement ] = new HeadingCommand( editor, option );
schema.registerItem( option.modelElement, '$block' );
}
Expand All @@ -42,13 +42,13 @@ describe( 'HeadingCommand', () => {
} );

afterEach( () => {
for ( let modelElement in commands ) {
for ( const modelElement in commands ) {
commands[ modelElement ].destroy();
}
} );

describe( 'basic properties', () => {
for ( let option of options ) {
for ( const option of options ) {
test( option );
}

Expand All @@ -62,7 +62,7 @@ describe( 'HeadingCommand', () => {
} );

describe( 'value', () => {
for ( let option of options ) {
for ( const option of options ) {
test( option );
}

Expand All @@ -75,8 +75,8 @@ describe( 'HeadingCommand', () => {
expect( commands[ modelElement ].value ).to.be.true;
} );

it( `equals false if inside to non-block element`, () => {
setData( document, `<notBlock>[foo]</notBlock>` );
it( 'equals false if inside to non-block element', () => {
setData( document, '<notBlock>[foo]</notBlock>' );

expect( commands[ modelElement ].value ).to.be.false;
} );
Expand Down Expand Up @@ -149,7 +149,7 @@ describe( 'HeadingCommand', () => {
describe( 'collapsed selection', () => {
let convertTo = options[ options.length - 1 ];

for ( let option of options ) {
for ( const option of options ) {
test( option, convertTo );
convertTo = option;
}
Expand Down Expand Up @@ -186,7 +186,7 @@ describe( 'HeadingCommand', () => {
describe( 'non-collapsed selection', () => {
let convertTo = options[ options.length - 1 ];

for ( let option of options ) {
for ( const option of options ) {
test( option, convertTo );
convertTo = option;
}
Expand Down Expand Up @@ -227,7 +227,7 @@ describe( 'HeadingCommand', () => {
} );

describe( 'isEnabled', () => {
for ( let option of options ) {
for ( const option of options ) {
test( option.modelElement );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/headingengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe( 'HeadingEngine', () => {
return VirtualTestEditor.create( {
plugins: [ Enter, HeadingEngine ],
heading: {
options: options
options
}
} )
.then( editor => {
Expand Down

0 comments on commit 795c5b0

Please sign in to comment.