Skip to content

Commit

Permalink
Merge pull request #3894 from WordPress/add/test/editable/adapt-forma…
Browse files Browse the repository at this point in the history
…tter

Add tests for Editable.adaptFormatter()

This is a private method, that will probably need to be reevaluated in how we test it.
  • Loading branch information
BE-Webdesign authored Dec 23, 2017
2 parents 21e5b26 + 2f27d54 commit 204c6b8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions blocks/editable/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ import Editable from '../';
import { diffAriaProps, pickAriaProps } from '../aria';

describe( 'Editable', () => {
describe( 'Component', () => {
describe( '.adaptFormatter', () => {
const wrapper = shallow( <Editable value={ [ 'valid' ] } /> );
const options = {
type: 'inline-style',
style: {
'font-weight': 'bold',
},
};

test( 'should return an object on inline: span, and a styles property matching the style object provided', () => {
expect( wrapper.instance().adaptFormatter( options ) ).toEqual( {
inline: 'span',
styles: options.style,
} );
} );
} );
} );
describe( '.propTypes', () => {
/* eslint-disable no-console */
let consoleError;
Expand Down

0 comments on commit 204c6b8

Please sign in to comment.