Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rg-mobile into add/autosave-monitor

* 'develop' of https://github.com/wordpress-mobile/gutenberg-mobile: (56 commits)
  Update gutenberg ref
  Update gutenberg ref
  Update gutenberg ref
  Update gutenberg ref
  Add support for group component (#1335)
  Update gutenberg hash
  fix error generating app name on sauce
  Bump eslint-utils from 1.3.1 to 1.4.2
  Update gutenberg ref
  Update release notes
  Update gutenberg ref to rnmobile/master HEAD
  disable paste tests
  MediaUpload and MediaPlaceholder unify props (#1310)
  Update gutenberg ref (#1340)
  Update gutenberg ref
  disable list tests and enable paste tests
  enable list tests
  enable list end tests
  enable block insertion tests
  enable heading tests
  ...

# Conflicts:
#	gutenberg
  • Loading branch information
daniloercoli committed Sep 4, 2019
2 parents 1ef6e68 + 200dfd5 commit 71c73ff
Show file tree
Hide file tree
Showing 24 changed files with 254 additions and 124 deletions.
7 changes: 7 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.12.0
------
* Add rich text styling to video captions
* Prevent keyboard dismissal when switching between caption and text block on Android
* Blocks that would be replaced are now hidden when add block bottom sheet displays
* Tapping on empty editor area now always inserts new block at end of post

1.11.0
------
* Toolbar scroll position now resets when its content changes.
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-block-insertion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor tests for Block insertion', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-heading.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor Image Block tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-lists-end.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor tests for List block (end)', () => {
let driver;
Expand Down
4 changes: 2 additions & 2 deletions __device-tests__/gutenberg-editor-lists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor tests for List block', () => {
xdescribe( 'Gutenberg Editor tests for List block', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paragraph.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor tests for Paragraph Block', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paste.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;

describe( 'Gutenberg Editor paste tests', () => {
// skip iOS for now
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-rotatation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;

describe( 'Gutenberg Editor tests', () => {
xdescribe( 'Gutenberg Editor tests', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/helpers/caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports.android8 = {
browserName: '',
platformName: 'Android',
platformVersion: '9.0',
deviceName: 'Google Pixel 3 GoogleAPI Emulator',
deviceName: 'Google Pixel 3 XL GoogleAPI Emulator',
automationName: 'UiAutomator2',
os: 'Android',
appPackage: 'com.gutenberg',
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const isLocalEnvironment = () => {
// Initialises the driver and desired capabilities for appium
const setupDriver = async () => {
const branch = process.env.CIRCLE_BRANCH || '';
const safeBranchName = branch.replace( '/', '-' );
const safeBranchName = branch.replace( /\//g, '-' );
if ( isLocalEnvironment() ) {
try {
appiumProcess = await AppiumLocal.start( localAppiumPort );
Expand Down
22 changes: 9 additions & 13 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
/** @format */

module.exports = function( api ) {
api.cache( true );
return {
presets: [
'module:metro-react-native-babel-preset',
],
presets: [ 'module:metro-react-native-babel-preset' ],
plugins: [
'@babel/plugin-proposal-async-generator-functions',
'@babel/plugin-transform-runtime',
[
'react-native-platform-specific-extensions',
{
extensions: [
'css',
'scss',
'sass',
],
extensions: [ 'css', 'scss', 'sass' ],
},
],
],
overrides: [
{ // Transforms JSX into JS function calls and use `createElement` instead of the default `React.createElement`
{
// Transforms JSX into JS function calls and use `createElement` instead of the default `React.createElement`
plugins: [
[
'@babel/plugin-transform-react-jsx',
Expand All @@ -31,7 +28,8 @@ module.exports = function( api ) {
],
exclude: /node_modules\/react-native/,
},
{ // Auto-add `import { createElement } from '@wordpress/element';` when JSX is found
{
// Auto-add `import { createElement } from '@wordpress/element';` when JSX is found
plugins: [
[
'./gutenberg/packages/babel-plugin-import-jsx-pragma',
Expand All @@ -48,9 +46,7 @@ module.exports = function( api ) {
],
env: {
development: {
plugins: [
'@babel/transform-react-jsx-source',
],
plugins: [ '@babel/transform-react-jsx-source' ],
},
},
};
Expand Down
1 change: 1 addition & 0 deletions bin/ci-checks-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fi
if [ "$CHECK_CORRECTNESS" = true ] ; then
yarn flow || pFail
yarn lint || pFail
yarn prettier:check || pFail
fi

if [ "$GUTENBERG_AS_PARENT" = true ] ; then
Expand Down
20 changes: 7 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,20 @@ module.exports = {
'/__device-tests__/',
],
testURL: 'http://localhost/',
modulePathIgnorePatterns: [ '<rootDir>/gutenberg/gutenberg-mobile', 'react-native-aztec-old-submodule' ],
modulePathIgnorePatterns: [
'<rootDir>/gutenberg/gutenberg-mobile',
'react-native-aztec-old-submodule',
],
moduleDirectories: [ 'node_modules', 'symlinked-packages' ],
moduleNameMapper: {
// Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
'\\.(scss)$': '<rootDir>/gutenberg/test/native/__mocks__/styleMock.js',
},
haste: {
defaultPlatform: rnPlatform,
platforms: [
'android',
'ios',
'native',
],
platforms: [ 'android', 'ios', 'native' ],
hasteImplModulePath: '<rootDir>/node_modules/react-native/jest/hasteImpl.js',
providesModuleNodeModules: [
'react-native',
'react-native-svg',
],
providesModuleNodeModules: [ 'react-native', 'react-native-svg' ],
},
transformIgnorePatterns: [
// This is required for now to have jest transform some of our modules
Expand All @@ -59,8 +55,6 @@ module.exports = {
// https://github.com/facebook/react-native/blob/master/jest-preset.json#L20
'node_modules/(?!(simple-html-tokenizer|(jest-)?react-native|react-clone-referenced-element))',
],
snapshotSerializers: [
'enzyme-to-json/serializer',
],
snapshotSerializers: [ 'enzyme-to-json/serializer' ],
reporters: [ 'default', 'jest-junit' ],
};
2 changes: 1 addition & 1 deletion libdefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ declare module 'react-native' {
}

declare module 'react-native/lib/TextInputState' {
declare module.exports: any;
declare module.exports: any;
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"eslint-plugin-react-native": "^3.6.0",
"eslint-plugin-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git#552af1454d175e15f6d25aadc2ccde30a1922d4f",
"flow-bin": "0.92.0",
"husky": "^3.0.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.1.0",
"jest-junit": "^6.3.0",
Expand All @@ -50,6 +51,11 @@
"sprintf-js": "^1.1.1",
"wd": "^1.11.1"
},
"husky": {
"hooks": {
"pre-commit": "yarn prettier:check"
}
},
"scripts": {
"start": "react-native start",
"start:inside-gb": "react-native start --config `pwd`/rn-cli-inside-gb.config.js",
Expand Down Expand Up @@ -101,6 +107,7 @@
"test:e2e:install-app:ios": "yarn test:e2e:build-app:ios",
"flow": "flow",
"prettier": "prettier-eslint --write $npm_package_config_jsfiles $npm_package_config_scssfiles",
"prettier:check": "prettier-eslint --list-different $npm_package_config_jsfiles $npm_package_config_scssfiles || { echo '\nERROR: `yarn prettier:check` found a formatting problem.\nNo files have been changed. Try running `yarn prettier` to fix any formatting issues.\n'; exit 1; }",
"clean": "yarn clean:aztec; yarn cache clean; yarn clean:haste; yarn clean:jest; yarn clean:metro; yarn clean:react; yarn clean:watchman; yarn clean:node;",
"clean:runtime": "yarn clean:haste; yarn clean:react; yarn clean:metro; yarn clean:jest; yarn clean:watchman; yarn clean:babel-cache",
"clean:aztec": "cd react-native-aztec && yarn clean && cd example && yarn clean",
Expand Down
8 changes: 6 additions & 2 deletions rn-cli-inside-gb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const path = require( 'path' );
const blacklist = require( 'metro-config/src/defaults/blacklist' );
// Blacklist the nested GB filetree so modules are not resolved in duplicates,
// both in the nested directory and the parent directory.
const blacklistElements = blacklist( [ new RegExp( path.basename( __dirname ) + '/gutenberg/.*' ) ] );
const blacklistElements = blacklist( [
new RegExp( path.basename( __dirname ) + '/gutenberg/.*' ),
] );

const enm = require( './extra-node-modules.config.js' );

Expand All @@ -19,7 +21,9 @@ const mapper = function( accu, v ) {
};

const wppackages = wppackagenames.reduce( mapper, {} );
const alternateRoots = [ path.resolve( __dirname, '../node_modules' ) ].concat( Object.values( wppackages ) );
const alternateRoots = [ path.resolve( __dirname, '../node_modules' ) ].concat(
Object.values( wppackages )
);

module.exports = {
extraNodeModules: Object.assign( enm, wppackages ),
Expand Down
4 changes: 1 addition & 3 deletions sass-transformer-inside-gb.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ if ( reactNativeMinorVersion >= 56 ) {
}

// TODO: need to find a way to pass the include paths and the default asset files via some config
const autoImportIncludePaths = [
path.join( path.dirname( __filename ), '../assets/stylesheets' ),
];
const autoImportIncludePaths = [ path.join( path.dirname( __filename ), '../assets/stylesheets' ) ];
const autoImportAssets = [
'_colors.scss',
'_breakpoints.scss',
Expand Down
20 changes: 10 additions & 10 deletions src/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,22 @@ $blue-500: #016087;

// Grays
$gray: #87a6bc;
$gray-light: lighten( $gray, 33% ); //#f3f6f8
$gray-dark: darken( $gray, 38% ); //#2e4453
$gray-900: #1A1A1A;
$gray-light: lighten($gray, 33%); //#f3f6f8
$gray-dark: darken($gray, 38%); //#2e4453
$gray-900: #1a1a1a;

// $gray-text: ideal for standard, non placeholder text
// $gray-text-min: minimum contrast needed for WCAG 2.0 AA on white background
$gray-text: $gray-dark;
$gray-text-min: darken( $gray, 18% ); //#537994
$gray-text-min: darken($gray, 18%); //#537994

// Shades of gray
$gray-lighten-10: lighten( $gray, 10% ); // #a8bece
$gray-lighten-20: lighten( $gray, 20% ); // #c8d7e1
$gray-lighten-30: lighten( $gray, 30% ); // #e9eff3
$gray-darken-10: darken( $gray, 10% ); // #668eaa
$gray-darken-20: darken( $gray, 20% ); // #4f748e
$gray-darken-30: darken( $gray, 30% ); // #3d596d
$gray-lighten-10: lighten($gray, 10%); // #a8bece
$gray-lighten-20: lighten($gray, 20%); // #c8d7e1
$gray-lighten-30: lighten($gray, 30%); // #e9eff3
$gray-darken-10: darken($gray, 10%); // #668eaa
$gray-darken-20: darken($gray, 20%); // #4f748e
$gray-darken-30: darken($gray, 30%); // #3d596d

//
// See wordpress.com/design-handbook/colors/ for more info.
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* External dependencies
*
* @format
*/

/**
* External dependencies
*/
Expand Down
39 changes: 19 additions & 20 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/** @format */

/**
Expand Down Expand Up @@ -45,32 +44,32 @@ describe( 'RootComponent', () => {
it( 'Code block is a TextInput', () => {
const app = renderer.create( <RootComponent /> );

app.root.findAllByType( BlockListBlock )
.forEach( ( blockHolder ) => {
if ( 'core/code' === blockHolder.props.name ) {
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
const contentComponent = blockHolderContainer.children[ 0 ];
const inputComponent =
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => {
if ( 'core/code' === blockHolder.props.name ) {
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
const blockHolderContainer =
blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
const contentComponent = blockHolderContainer.children[ 0 ];
const inputComponent =
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
.children[ 0 ];

expect( inputComponent.type ).toBe( 'TextInput' );
}
} );
expect( inputComponent.type ).toBe( 'TextInput' );
}
} );

app.unmount();
} );

it( 'Heading block test', () => {
const app = renderer.create( <RootComponent /> );
app.root.findAllByType( BlockListBlock )
.forEach( ( blockHolder ) => {
if ( 'core/heading' === blockHolder.props.name ) {
const aztec = blockHolder.findByType( 'RCTAztecView' );
expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' );
}
} );
app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => {
if ( 'core/heading' === blockHolder.props.name ) {
const aztec = blockHolder.findByType( 'RCTAztecView' );
expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' );
}
} );
app.unmount();
} );
} );
Loading

0 comments on commit 71c73ff

Please sign in to comment.