Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework: Update npm packages to remove warnings from the console #3908

Merged
merged 3 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions blocks/block-icon/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ describe( 'BlockIcon', () => {
} );

it( 'renders a component', () => {
class MyComponent extends Component {
Copy link
Member Author

@gziolo gziolo Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eslint had some issues with having this inlined ...

45:5 error Your render method should have return statement react/require-render-return

render() {
return <span />;
}
}
const wrapper = shallow(
<BlockIcon icon={
class MyComponent extends Component {
render() {
return <span />;
}
}
} />
<BlockIcon icon={ MyComponent } />
);

expect( wrapper.name() ).toBe( 'MyComponent' );
Expand Down
6 changes: 3 additions & 3 deletions blocks/inspector-controls/range-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe( 'RangeControl', () => {

wrapper = mount( <RangeControl /> );
icons = wrapper.find( 'Dashicon' );
expect( icons.length ).toBe( 0 );
expect( icons ).toHaveLength( 0 );

wrapper = mount( <RangeControl beforeIcon="format-image" /> );
icons = wrapper.find( 'Dashicon' );
expect( icons.length ).toBe( 1 );
expect( icons ).toHaveLength( 1 );
expect( icons.at( 0 ).prop( 'icon' ) ).toBe( 'format-image' );

wrapper = mount(
Expand All @@ -40,7 +40,7 @@ describe( 'RangeControl', () => {
afterIcon="format-video" />
);
icons = wrapper.find( 'Dashicon' );
expect( icons.length ).toBe( 2 );
expect( icons ).toHaveLength( 2 );
expect( icons.at( 0 ).prop( 'icon' ) ).toBe( 'format-image' );
expect( icons.at( 1 ).prop( 'icon' ) ).toBe( 'format-video' );
} );
Expand Down
4 changes: 2 additions & 2 deletions blocks/url-input/test/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ describe( 'UrlInputButton', () => {
} );
it( 'should have hidden form by default', () => {
const wrapper = shallow( <UrlInputButton /> );
expect( wrapper.find( 'form' ).length ).toBe( 0 );
expect( wrapper.find( 'form' ) ).toHaveLength( 0 );
expect( wrapper.state().expanded ).toBe( false );
} );
it( 'should have visible form when Edit Link button clicked', () => {
const wrapper = shallow( <UrlInputButton /> );
clickEditLink( wrapper );
expect( wrapper.find( 'form' ).length ).toBe( 1 );
expect( wrapper.find( 'form' ) ).toHaveLength( 1 );
expect( wrapper.state().expanded ).toBe( true );
} );
it( 'should call onChange function once when value changes once', () => {
Expand Down
8 changes: 4 additions & 4 deletions components/panel/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ describe( 'Panel', () => {
const panel = shallow( <Panel /> );
expect( panel.hasClass( 'components-panel' ) ).toBe( true );
expect( panel.type() ).toBe( 'div' );
expect( panel.find( 'div' ).shallow().children().length ).toBe( 0 );
expect( panel.find( 'div' ).shallow().children() ).toHaveLength( 0 );
} );

it( 'should render a PanelHeader component when provided text in the header prop', () => {
const panel = shallow( <Panel header="Header Label" /> );
const panelHeader = panel.find( 'PanelHeader' );
expect( panelHeader.prop( 'label' ) ).toBe( 'Header Label' );
expect( panel.find( 'div' ).shallow().children().length ).toBe( 1 );
expect( panel.find( 'div' ).shallow().children() ).toHaveLength( 1 );
} );

it( 'should render an additional className', () => {
Expand All @@ -32,12 +32,12 @@ describe( 'Panel', () => {
it( 'should add additional child elements to be rendered in the panel', () => {
const panel = shallow( <Panel children="The Panel" /> );
expect( panel.text() ).toBe( 'The Panel' );
expect( panel.find( 'div' ).shallow().children().length ).toBe( 1 );
expect( panel.find( 'div' ).shallow().children() ).toHaveLength( 1 );
} );

it( 'should render both children and header when provided as props', () => {
const panel = shallow( <Panel children="The Panel" header="The Header" /> );
expect( panel.find( 'div' ).shallow().children().length ).toBe( 2 );
expect( panel.find( 'div' ).shallow().children() ).toHaveLength( 2 );
} );
} );
} );
30 changes: 15 additions & 15 deletions components/tab-panel/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,37 @@ describe( 'TabPanel', () => {
const getActiveView = () => wrapper.find( 'div[role="tabpanel"]' );

expect( getActiveTab().text() ).toBe( 'Alpha' );
expect( getAlphaView().length ).toBe( 1 );
expect( getBetaView().length ).toBe( 0 );
expect( getGammaView().length ).toBe( 0 );
expect( getAlphaView() ).toHaveLength( 1 );
expect( getBetaView() ).toHaveLength( 0 );
expect( getGammaView() ).toHaveLength( 0 );
expect( getActiveView().text() ).toBe( 'alpha' );

betaTab.simulate( 'click' );
expect( getActiveTab().text() ).toBe( 'Beta' );
expect( getAlphaView().length ).toBe( 0 );
expect( getBetaView().length ).toBe( 1 );
expect( getGammaView().length ).toBe( 0 );
expect( getAlphaView() ).toHaveLength( 0 );
expect( getBetaView() ).toHaveLength( 1 );
expect( getGammaView() ).toHaveLength( 0 );
expect( getActiveView().text() ).toBe( 'beta' );

betaTab.simulate( 'click' );
expect( getActiveTab().text() ).toBe( 'Beta' );
expect( getAlphaView().length ).toBe( 0 );
expect( getBetaView().length ).toBe( 1 );
expect( getGammaView().length ).toBe( 0 );
expect( getAlphaView() ).toHaveLength( 0 );
expect( getBetaView() ).toHaveLength( 1 );
expect( getGammaView() ).toHaveLength( 0 );
expect( getActiveView().text() ).toBe( 'beta' );

gammaTab.simulate( 'click' );
expect( getActiveTab().text() ).toBe( 'Gamma' );
expect( getAlphaView().length ).toBe( 0 );
expect( getBetaView().length ).toBe( 0 );
expect( getGammaView().length ).toBe( 1 );
expect( getAlphaView() ).toHaveLength( 0 );
expect( getBetaView() ).toHaveLength( 0 );
expect( getGammaView() ).toHaveLength( 1 );
expect( getActiveView().text() ).toBe( 'gamma' );

alphaTab.simulate( 'click' );
expect( getActiveTab().text() ).toBe( 'Alpha' );
expect( getAlphaView().length ).toBe( 1 );
expect( getBetaView().length ).toBe( 0 );
expect( getGammaView().length ).toBe( 0 );
expect( getAlphaView() ).toHaveLength( 1 );
expect( getBetaView() ).toHaveLength( 0 );
expect( getGammaView() ).toHaveLength( 0 );
expect( getActiveView().text() ).toBe( 'alpha' );
} );
} );
Expand Down
22 changes: 11 additions & 11 deletions editor/components/inserter/test/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe( 'InserterMenu', () => {
expect( activeCategory.text() ).toBe( 'Recent' );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 0 );
expect( visibleBlocks ).toHaveLength( 0 );
} );

it( 'should show no blocks if all block types disabled', () => {
Expand All @@ -125,7 +125,7 @@ describe( 'InserterMenu', () => {
);

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 0 );
expect( visibleBlocks ).toHaveLength( 0 );
} );

it( 'should show filtered block types', () => {
Expand All @@ -143,7 +143,7 @@ describe( 'InserterMenu', () => {
);

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 1 );
expect( visibleBlocks ).toHaveLength( 1 );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'Text' );
} );

Expand All @@ -170,7 +170,7 @@ describe( 'InserterMenu', () => {
);

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 3 );
expect( visibleBlocks ).toHaveLength( 3 );
expect( visibleBlocks.at( 0 ).childAt( 0 ).name() ).toBe( 'BlockIcon' );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'Advanced Text' );
} );
Expand All @@ -196,7 +196,7 @@ describe( 'InserterMenu', () => {
expect( activeCategory.text() ).toBe( 'Embeds' );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 2 );
expect( visibleBlocks ).toHaveLength( 2 );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'YouTube' );
expect( visibleBlocks.at( 1 ).text() ).toBe( 'A Text Embed' );
} );
Expand All @@ -222,7 +222,7 @@ describe( 'InserterMenu', () => {
expect( activeCategory.text() ).toBe( 'Blocks' );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 4 );
expect( visibleBlocks ).toHaveLength( 4 );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'Text' );
expect( visibleBlocks.at( 1 ).text() ).toBe( 'Advanced Text' );
expect( visibleBlocks.at( 2 ).text() ).toBe( 'Some Other Block' );
Expand All @@ -248,7 +248,7 @@ describe( 'InserterMenu', () => {
wrapper.update();

const disabledBlocks = wrapper.find( '.editor-inserter__block[disabled]' );
expect( disabledBlocks.length ).toBe( 1 );
expect( disabledBlocks ).toHaveLength( 1 );
expect( disabledBlocks.at( 0 ).text() ).toBe( 'More' );
} );

Expand All @@ -268,10 +268,10 @@ describe( 'InserterMenu', () => {
wrapper.setState( { filterValue: 'text' } );

const tabs = wrapper.find( '.editor-inserter__tab' );
expect( tabs.length ).toBe( 0 );
expect( tabs ).toHaveLength( 0 );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 3 );
expect( visibleBlocks ).toHaveLength( 3 );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'Text' );
expect( visibleBlocks.at( 1 ).text() ).toBe( 'Advanced Text' );
expect( visibleBlocks.at( 2 ).text() ).toBe( 'A Text Embed' );
Expand All @@ -293,10 +293,10 @@ describe( 'InserterMenu', () => {
wrapper.setState( { filterValue: ' text' } );

const tabs = wrapper.find( '.editor-inserter__tab' );
expect( tabs.length ).toBe( 0 );
expect( tabs ).toHaveLength( 0 );

const visibleBlocks = wrapper.find( '.editor-inserter__block' );
expect( visibleBlocks.length ).toBe( 3 );
expect( visibleBlocks ).toHaveLength( 3 );
expect( visibleBlocks.at( 0 ).text() ).toBe( 'Text' );
expect( visibleBlocks.at( 1 ).text() ).toBe( 'Advanced Text' );
expect( visibleBlocks.at( 2 ).text() ).toBe( 'A Text Embed' );
Expand Down
6 changes: 3 additions & 3 deletions element/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe( 'element', () => {
[ createElement( 'strong', {}, 'Courgette' ) ],
createElement( 'strong', {}, 'Concombre' )
);
expect( concat.length ).toBe( 2 );
expect( concat ).toHaveLength( 2 );
expect( concat[ 0 ].key ).toBe( '0,0' );
expect( concat[ 1 ].key ).toBe( '1,0' );
} );
Expand All @@ -73,7 +73,7 @@ describe( 'element', () => {

it( 'should switch strings', () => {
const children = switchChildrenNodeName( [ 'a', 'b' ], 'strong' );
expect( children.length ).toBe( 2 );
expect( children ).toHaveLength( 2 );
expect( children[ 0 ].type ).toBe( 'strong' );
expect( children[ 0 ].props.children ).toBe( 'a' );
expect( children[ 1 ].type ).toBe( 'strong' );
Expand All @@ -85,7 +85,7 @@ describe( 'element', () => {
createElement( 'strong', { align: 'left' }, 'Courgette' ),
createElement( 'strong', {}, 'Concombre' ),
], 'em' );
expect( children.length ).toBe( 2 );
expect( children ).toHaveLength( 2 );
expect( children[ 0 ].type ).toBe( 'em' );
expect( children[ 0 ].props.children ).toBe( 'Courgette' );
expect( children[ 0 ].props.align ).toBe( 'left' );
Expand Down
6 changes: 3 additions & 3 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,16 @@ function gutenberg_register_vendor_scripts() {

gutenberg_register_vendor_script(
'react',
'https://unpkg.com/react@16.0.0/umd/react' . $react_suffix . '.js'
'https://unpkg.com/react@16.2.0/umd/react' . $react_suffix . '.js'
);
gutenberg_register_vendor_script(
'react-dom',
'https://unpkg.com/react-dom@16.0.0/umd/react-dom' . $react_suffix . '.js',
'https://unpkg.com/react-dom@16.2.0/umd/react-dom' . $react_suffix . '.js',
array( 'react' )
);
gutenberg_register_vendor_script(
'react-dom-server',
'https://unpkg.com/react-dom@16.0.0/umd/react-dom-server.browser' . $react_suffix . '.js',
'https://unpkg.com/react-dom@16.2.0/umd/react-dom-server.browser' . $react_suffix . '.js',
array( 'react' )
);
$moment_script = SCRIPT_DEBUG ? 'moment.js' : 'min/moment.min.js';
Expand Down
Loading