Skip to content

Commit

Permalink
Merge branch 'master' into fix/autosaves
Browse files Browse the repository at this point in the history
# Conflicts:
#	editor/store/reducer.js
#	lib/load.php
#	lib/rest-api.php
  • Loading branch information
Adam Silverstein committed May 11, 2018
2 parents e83bdc2 + dfc22ed commit 00d586a
Show file tree
Hide file tree
Showing 134 changed files with 2,050 additions and 1,416 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ module.exports = {
selector: 'CallExpression[callee.name=/^(invokeMap|get|has|hasIn|invoke|result|set|setWith|unset|update|updateWith)$/] > Literal:nth-child(2)',
message: 'Always pass an array as the path argument',
},
{
selector: 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
message: 'Use ellipsis character (…) in place of three dots',
},
],
},
overrides: [
Expand Down
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
- Please add the version of Gutenberg you are using in the description.
- To report a security issue, please visit the WordPress HackerOne program: https://hackerone.com/wordpress.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/Custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Question
about: Questions or 'how to' about Gutenberg

---

If you have a question you have a few places that you can ask this:

- Support Forums: https://wordpress.org/support/plugin/gutenberg
- Handbook: https://wordpress.org/gutenberg/handbook
- https://chat.wordpress.org #core-editor

If you are unable to ask in those places you can ask here, however you will get faster responses through those recommended places.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ cache:

before_install:
- nvm install && nvm use
- npm install npm -g

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion bin/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker-compose down --remove-orphans >/dev/null 2>&1

# Download image updates
echo -e $(status_message "Downloading Docker image updates...")
docker-compose pull --parallel
docker-compose pull

# Launch the containers
echo -e $(status_message "Starting Docker containers...")
Expand Down
3 changes: 3 additions & 0 deletions bin/install-node-nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ fi
echo -e $(status_message "Installing and updating NPM packages..." )
npm install

# Make sure npm is up-to-date
npm install npm -g

# There was a bug in NPM that caused changes in package-lock.json. Handle that.
if [ "$TRAVIS" != "true" ] && ! git diff --exit-code package-lock.json >/dev/null; then
if ask "$(warning_message "Your package-lock.json changed, which may mean there's an issue with your NPM cache. Would you like to try and automatically clean it up?" )" N 10; then
Expand Down
14 changes: 6 additions & 8 deletions bin/install-php-phpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ if [[ ${SWITCH_TO_PHP:0:3} == "5.2" ]] || [[ ${SWITCH_TO_PHP:0:3} == "5.3" ]]; t
$HOME/php-utils-bin/phpbrew known --old

# build PHP5.2
tail -F $HOME/.phpbrew/build/php-5.2.17/build.log &
TAIL_PID=$!
echo 'Installing PHP 5.2...'
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.2 +default +mysql +pdo \
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr
kill -TERM $TAIL_PID
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr \
> /dev/null

# build PHP5.3
tail -F $HOME/.phpbrew/build/php-5.3.29/build.log &
TAIL_PID=$!
echo 'Installing PHP 5.3...'
$HOME/php-utils-bin/phpbrew install --patch ${THIS_DIR}/patches/node.patch --patch ${THIS_DIR}/patches/openssl.patch 5.3 +default +mysql +pdo \
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr
kill -TERM $TAIL_PID
+gettext +phar +openssl -- --with-openssl-dir=/usr/include/openssl --enable-spl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr \
> /dev/null

# install PHPUnit 3.6. The only install method available is from source, using git branches old
# enough that they don't rely on any PHP5.3+ features. This clones each needed dependency
Expand Down
92 changes: 0 additions & 92 deletions blocks/editor-settings/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@
// Blocks are inferred from the HTML source of a post through a parsing mechanism
// and then stored as objects in state, from which it is then rendered for editing.
export * from './api';

export { default as editorMediaUpload } from './editor-media-upload';
export { default as EditorSettings, withEditorSettings } from './editor-settings';
92 changes: 36 additions & 56 deletions components/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,47 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { Component, createElement } from '@wordpress/element';
import { createElement, forwardRef } from '@wordpress/element';

/**
* Internal dependencies
*/
import './style.scss';

class Button extends Component {
constructor( props ) {
super( props );
this.setRef = this.setRef.bind( this );
}

componentDidMount() {
if ( this.props.focus ) {
this.ref.focus();
}
}

setRef( ref ) {
this.ref = ref;
}

focus() {
this.ref.focus();
}

render() {
const {
href,
target,
isPrimary,
isLarge,
isSmall,
isToggled,
isBusy,
className,
disabled,
...additionalProps
} = this.props;
const classes = classnames( 'components-button', className, {
button: ( isPrimary || isLarge || isSmall ),
'button-primary': isPrimary,
'button-large': isLarge,
'button-small': isSmall,
'is-toggled': isToggled,
'is-busy': isBusy,
} );

const tag = href !== undefined && ! disabled ? 'a' : 'button';
const tagProps = tag === 'a' ? { href, target } : { type: 'button', disabled };

delete additionalProps.focus;

return createElement( tag, {
...tagProps,
...additionalProps,
className: classes,
ref: this.setRef,
} );
}
export function Button( props, ref ) {
const {
href,
target,
isPrimary,
isLarge,
isSmall,
isToggled,
isBusy,
className,
disabled,
focus,
...additionalProps
} = props;

const classes = classnames( 'components-button', className, {
button: ( isPrimary || isLarge || isSmall ),
'button-primary': isPrimary,
'button-large': isLarge,
'button-small': isSmall,
'is-toggled': isToggled,
'is-busy': isBusy,
} );

const tag = href !== undefined && ! disabled ? 'a' : 'button';
const tagProps = tag === 'a' ? { href, target } : { type: 'button', disabled };

return createElement( tag, {
...tagProps,
...additionalProps,
className: classes,
autoFocus: focus,
ref,
} );
}

export default Button;
export default forwardRef( Button );
26 changes: 24 additions & 2 deletions components/button/test/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
/**
* External dependencies
*/
import { shallow } from 'enzyme';
import { mount, shallow } from 'enzyme';

/**
* WordPress dependencies
*/
import { createRef } from '@wordpress/element';

/**
* Internal dependencies
*/
import Button from '../';
import ButtonWithForwardedRef, { Button } from '../';

// [TEMPORARY]: Only needed so long as Enzyme does not support React.forwardRef
jest.unmock( '../' );

describe( 'Button', () => {
describe( 'basic rendering', () => {
Expand Down Expand Up @@ -93,4 +101,18 @@ describe( 'Button', () => {
expect( button.type() ).toBe( 'button' );
} );
} );

// Disable reason: This test is desirable, but unsupported by Enzyme in
// the current version, as it depends on features new to React in 16.3.0.
//
// eslint-disable-next-line jest/no-disabled-tests
describe.skip( 'ref forwarding', () => {
it( 'should enable access to DOM element', () => {
const ref = createRef();

mount( <ButtonWithForwardedRef ref={ ref } /> );

expect( ref.current.nodeName ).toBe( 'button' );
} );
} );
} );
Loading

0 comments on commit 00d586a

Please sign in to comment.