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

Commit

Permalink
Merge 2b1ceaa into 639311e
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed May 20, 2019
2 parents 639311e + 2b1ceaa commit 03a01d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/imagestyle/imagestylecommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export default class ImageStyleCommand extends Command {
super( editor );

/**
* The cached name of the default style if it is present. If there is no default style, it defaults to `false`.
* The name of the default style, if it is present. If there is no default style, it defaults to `false`.
*
* @readonly
* @type {Boolean|String}
* @private
*/
this._defaultStyle = false;
this.defaultStyle = false;

/**
* A style handled by this command.
Expand All @@ -43,7 +43,7 @@ export default class ImageStyleCommand extends Command {
styles[ style.name ] = style;

if ( style.isDefault ) {
this._defaultStyle = style.name;
this.defaultStyle = style.name;
}

return styles;
Expand All @@ -64,7 +64,7 @@ export default class ImageStyleCommand extends Command {
const attributeValue = element.getAttribute( 'imageStyle' );
this.value = this.styles[ attributeValue ] ? attributeValue : false;
} else {
this.value = this._defaultStyle;
this.value = this.defaultStyle;
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/imagestyle/imagestylecommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ describe( 'ImageStyleCommand', () => {
} );
} );

it( 'should have defaultStyle property correctly set', () => {
expect( command.defaultStyle ).to.equal( 'defaultStyle' );
} );

it( 'command value should be false if no image is selected', () => {
setData( model, '[]<image></image>' );

Expand Down

0 comments on commit 03a01d7

Please sign in to comment.