{
- it( 'renders nothing when icon omitted', () => {
- const wrapper = shallow(
);
+ it( 'renders a Icon', () => {
+ const wrapper = shallow(
);
- expect( wrapper.type() ).toBeNull();
+ expect( wrapper.containsMatchingElement(
) ).toBe( true );
} );
- it( 'renders a dashicon by slug', () => {
+ it( 'renders a div without the has-colors classname', () => {
const wrapper = shallow(
);
- expect( wrapper.find( 'Dashicon' ).prop( 'icon' ) ).toBe( 'format-image' );
+ expect( wrapper.find( 'div' ).hasClass( 'has-colors' ) ).toBe( false );
} );
- it( 'renders a function', () => {
- const wrapper = shallow(
} /> );
+ it( 'renders a div with the has-colors classname', () => {
+ const wrapper = shallow( );
- expect( wrapper.childAt( 0 ).name() ).toBe( 'span' );
+ expect( wrapper.find( 'div' ).hasClass( 'has-colors' ) ).toBe( true );
} );
- it( 'renders an element', () => {
- const wrapper = shallow( } /> );
+ it( 'skips adding background and foreground styles when colors are not enabled', () => {
+ const wrapper = shallow( );
- expect( wrapper.childAt( 0 ).name() ).toBe( 'span' );
+ expect( wrapper.find( 'div' ).prop( 'style' ) ).toEqual( {} );
} );
- it( 'renders a component', () => {
- class MyComponent extends Component {
- render() {
- return ;
- }
- }
- const wrapper = shallow(
-
- );
-
- expect( wrapper.childAt( 0 ).name() ).toBe( 'MyComponent' );
+ it( 'adds background and foreground styles when colors are enabled', () => {
+ const wrapper = shallow( );
+
+ expect( wrapper.find( 'div' ).prop( 'style' ) ).toEqual( {
+ backgroundColor: 'white',
+ color: 'black',
+ } );
} );
} );
diff --git a/packages/editor/src/components/inserter/menu.js b/packages/editor/src/components/inserter/menu.js
index 21f8279c80ddf..7af57b6af6add 100644
--- a/packages/editor/src/components/inserter/menu.js
+++ b/packages/editor/src/components/inserter/menu.js
@@ -295,6 +295,7 @@ export class InserterMenu extends Component {