Skip to content

Commit

Permalink
Merge pull request #18 from dlh01/0.4.0
Browse files Browse the repository at this point in the history
Version 0.4
  • Loading branch information
dlh01 authored Mar 24, 2017
2 parents 7ca58dd + 5f6532f commit b21a288
Show file tree
Hide file tree
Showing 21 changed files with 1,315 additions and 92 deletions.
74 changes: 56 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,67 @@
language: php

notifications:
email:
on_success: never
on_failure: change
sudo: false

branches:
only:
- master
language: php

php:
- 5.3
- 5.6
git:
depth: 1

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=3.7 WP_MULTISITE=0
- WP_VERSION=4.7-alpha-38178-src WP_MULTISITE=0
notifications:
email: false

matrix:
# - Lint PHP once per PHP version.
#
# - Run `phpunit` for each version of PHP and WordPress in single- and multisite.
#
# - Run `qunit:recent` once. The `recent` task handles running tests against
# different versions of WordPress. If we switch to WP_VERSION=x.y.z we could
# instead run `qunit:specific --wp=$WP_VERSION` so that control over which
# versions are tested stays in this config.
include:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1
env: WP_VERSION=latest PHP_LINT=1

- php: 5.6
env: WP_VERSION=latest PHP_LINT=1

- php: 7.0
env: WP_VERSION=trunk QUNIT_RECENT=1
- php: 7.0
env: WP_VERSION=latest PHP_LINT=1

- php: 7.1
env: WP_VERSION=latest PHP_LINT=1

before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- export WP_CORE_DIR=/tmp/wordpress

- |
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
composer global require "phpunit/phpunit=5.7.*"
else
composer global require "phpunit/phpunit=4.8.*"
fi
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION

script: phpunit
- git clone --depth=1 https://github.com/alleyinteractive/wordpress-fieldmanager $WP_CORE_DIR/wp-content/plugins/wordpress-fieldmanager

- |
if [[ "$QUNIT_RECENT" == "1" ]]; then
npm install
fi
script:
- |
if [[ "$PHP_LINT" == "1" ]]; then
find . -type "f" -iname "*.php" | xargs -L "1" php -l
fi
- |
if [[ "$QUNIT_RECENT" == "1" ]]; then
grunt qunit:recent
fi
- export WP_MULTISITE=0 && phpunit
- export WP_MULTISITE=1 && phpunit
60 changes: 48 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = function( grunt ) {

'use strict';

var banner = '/**\n * <%= pkg.homepage %>\n * Copyright (c) <%= grunt.template.today("yyyy") %>\n * This file is generated automatically. Do not edit.\n */\n';

// Project configuration
grunt.initConfig( {

pkg: grunt.file.readJSON( 'package.json' ),

addtextdomain: {
Expand All @@ -18,15 +18,12 @@ module.exports = function( grunt ) {
}
},

wp_readme_to_markdown: {
options: {
screenshot_url: './assets/{screenshot}.png',
},
your_target: {
files: {
'README.md': 'readme.txt'
connect: {
server: {
options: {
base: '.'
}
},
}
},

makepot: {
Expand All @@ -44,14 +41,53 @@ module.exports = function( grunt ) {
}
}
},

qunit: {
trunk: {
options: {
urls: ['http://localhost:8000/tests/js/index.html']
}
},
recent: {
options: {
urls: [
'http://localhost:8000/tests/js/index.html',
'http://localhost:8000/tests/js/index.html?wp=4.7',
'http://localhost:8000/tests/js/index.html?wp=4.6',
]
}
},
specific: {
options: {
urls: [ 'http://localhost:8000/tests/js/index.html?wp=' + grunt.option( 'wp' ) ]
}
}
},

wp_readme_to_markdown: {
options: {
screenshot_url: './assets/{screenshot}.png',
},
your_target: {
files: {
'README.md': 'readme.txt'
}
},
},
} );

grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );

if ( /(qunit|prerelease)/.test( grunt.cli.tasks.join( '' ).toLowerCase() ) ) {
grunt.task.run( 'connect' );
}

grunt.registerTask( 'i18n', [ 'addtextdomain', 'makepot' ] );
grunt.registerTask( 'readme', [ 'wp_readme_to_markdown' ] );
grunt.registerTask( 'prerelease', [ 'i18n', 'readme' ] );
grunt.registerTask( 'prerelease', [ 'qunit:recent', 'i18n', 'readme' ] );

grunt.util.linefeed = '\n';

};
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Fieldmanager Beta: Customize #
**Contributors:** [dlh](https://profiles.wordpress.org/dlh), [jamesburke](https://profiles.wordpress.org/jamesburke), [alleyinteractive](https://profiles.wordpress.org/alleyinteractive)
**Requires at least:** 4.4
**Requires at least:** 4.5
**Tested up to:** 4.7
**Stable tag:** 0.3.1
**Stable tag:** 0.4.0
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -12,7 +12,7 @@ A Fieldmanager Beta plugin for the Customize Context.

This is a proposed Customize context for Fieldmanager. You can install the plugin alongside a stable Fieldmanager release to help test and refine the context.

The official Pull Request for this context, plus tests, is [on GitHub](https://github.com/alleyinteractive/wordpress-fieldmanager/pull/399).
The official Pull Request for this context is [on GitHub](https://github.com/alleyinteractive/wordpress-fieldmanager/pull/399).

## Installation ##

Expand Down Expand Up @@ -41,6 +41,13 @@ For more code examples, browse `php/demos/class-fieldmanager-beta-customize-demo

## Changelog ##

### 0.4.0 ###
* Added: PHP and JavaScript tests.
* Added: Demo a field with selective-refresh support.
* Changed: Use better TinyMCE events for tracking `Fieldmanager_RichTextArea` changes.
* Changed: Require at least WordPress 4.5.
* Fixed: Fix a case where invisible Customizer sections could be created.

### 0.3.1 ###
* Fixed: Track the changes to instances of repeatable RichTextAreas and Colorpickers added after loading the Customizer.

Expand Down
1 change: 1 addition & 0 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ install_test_suite() {
# set up testing suite
mkdir -p $WP_TESTS_DIR
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
fi

if [ ! -f wp-tests-config.php ]; then
Expand Down
25 changes: 16 additions & 9 deletions fieldmanager-beta-customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.alleyinteractive.com
* Text Domain: fieldmanager-beta-customizer
* Domain Path: /languages
* Version: 0.3.1
* Version: 0.4.0
*
* @package Fieldmanager_Beta_Customize
*/
Expand All @@ -25,7 +25,19 @@
/**
* Plugin version.
*/
define( 'FM_BETA_CUSTOMIZE_VERSION', '0.3.1' );
define( 'FM_BETA_CUSTOMIZE_VERSION', '0.4.0' );

/**
* Load plugin class files.
*
* @since 0.4.0
*/
function fm_beta_customize_load_plugin_classes() {
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/context/class-fieldmanager-beta-context-customize.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/customize/class-fieldmanager-beta-customize-control.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/customize/class-fieldmanager-beta-customize-setting.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/field/class-fieldmanager-beta-customize-richtextarea.php' );
}

/**
* Calculate a Fieldmanager context for the Customizer.
Expand All @@ -50,13 +62,7 @@
* We aren't registering an autoloader because if Fieldmanager core's autoloader
* is registered first, and it doesn't find a file, it throws an exception.
*/
add_action( 'fm_beta_customize', function () {
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/context/class-fieldmanager-beta-context-customize.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/customize/class-fieldmanager-beta-customize-control.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/customize/class-fieldmanager-beta-customize-setting.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/demo/class-fieldmanager-beta-customize-demo.php' );
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/field/class-fieldmanager-beta-customize-richtextarea.php' );
}, 0 );
add_action( 'fm_beta_customize', 'fm_beta_customize_load_plugin_classes', 0 );

/**
* Enqueue assets managed by Fieldmanager_Util_Assets in the Customizer.
Expand Down Expand Up @@ -130,5 +136,6 @@ function fm_beta_customize_add_to_customizer( $args = array(), $fm ) {
* Instantiate the bundled context demos.
*/
function fm_beta_customize_demo() {
require_once( FM_BETA_CUSTOMIZE_PATH . 'php/demo/class-fieldmanager-beta-customize-demo.php' );
Fieldmanager_Beta_Customize_Demo::instance();
}
8 changes: 4 additions & 4 deletions js/fieldmanager-beta-customize-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@

// Respond to RichTextArea changes.
$( document ).on( 'tinymce-editor-init', function ( event, editor ) {
var editor_element = document.getElementById( editor.id );
var editorElement = document.getElementById( editor.id );

if ( editor_element && editor_element.classList.contains( 'fm-richtext' ) ) {
editor.on( 'keyup AddUndo SetContent', function () {
if ( editorElement && editorElement.classList.contains( 'fm-richtext' ) ) {
editor.on( 'input change keyup', function () {
editor.save();
fm.beta.customize.setControlsContainingElement( editor_element );
fm.beta.customize.setControlsContainingElement( editorElement );
});
}
});
Expand Down
8 changes: 8 additions & 0 deletions js/fieldmanager-beta-customize.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
/**
* Set a Fieldmanager setting to its control's form values.
*
* Updates to fields are generally not debounced or throttled because
* these create FM-specific deviations to how users experience the
* Customizer and add maintenance requirements for the plugin.
*
* Without debouncing or throttling, changes to settings using the
* `postMessage` transport are faster. The Customizer's refresh
* framework also debounces natively.
*
* @param {Object} control Customizer Control object.
* @return {Object} The updated Control.
*/
Expand Down
22 changes: 15 additions & 7 deletions languages/fieldmanager-beta-customize.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the same license as the Fieldmanager Beta: Customize package.
msgid ""
msgstr ""
"Project-Id-Version: Fieldmanager Beta: Customize 0.3.1\n"
"Project-Id-Version: Fieldmanager Beta: Customize 0.4.0\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/fieldmanager-beta-customize\n"
"POT-Creation-Date: 2017-01-22 00:22:27+00:00\n"
"POT-Creation-Date: 2017-03-23 03:56:54+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand All @@ -25,7 +25,7 @@ msgstr ""
"X-Poedit-Bookmarks: \n"
"X-Textdomain-Support: yes\n"

#: php/context/class-fieldmanager-beta-context-customize.php:90
#: php/context/class-fieldmanager-beta-context-customize.php:89
msgid "Invalid value."
msgstr ""

Expand All @@ -41,22 +41,30 @@ msgid ""
"Fieldmanager_Beta_Context_Customize"
msgstr ""

#: php/demo/class-fieldmanager-beta-customize-demo.php:87
#: php/demo/class-fieldmanager-beta-customize-demo.php:116
msgid "Twitter Handle"
msgstr ""

#: php/demo/class-fieldmanager-beta-customize-demo.php:88
#: php/demo/class-fieldmanager-beta-customize-demo.php:117
msgid "Facebook URL"
msgstr ""

#: php/demo/class-fieldmanager-beta-customize-demo.php:89
#: php/demo/class-fieldmanager-beta-customize-demo.php:118
msgid "Instagram Handle"
msgstr ""

#: php/demo/class-fieldmanager-beta-customize-demo.php:90
#: php/demo/class-fieldmanager-beta-customize-demo.php:119
msgid "YouTube URL"
msgstr ""

#: tests/php/test-fieldmanager-beta-context-customize.php:189
msgid "Failed with $debug = true"
msgstr ""

#: tests/php/test-fieldmanager-beta-context-customize.php:189
msgid "Failed with $debug = false"
msgstr ""

#. Plugin Name of the plugin/theme
msgid "Fieldmanager Beta: Customize"
msgstr ""
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"name": "fieldmanager-beta-customize",
"version": "0.1.0",
"version": "0.4.0",
"main": "Gruntfile.js",
"contributors": [
"David Herrera",
"James Burke",
"Alley Interactive"
],
"devDependencies": {
"grunt": "~0.4.5",
"grunt": "~1.0.0",
"grunt-contrib-connect": "~1.0.0",
"grunt-contrib-qunit": "~1.3.0",
"grunt-wp-i18n": "~0.5.0",
"grunt-wp-readme-to-markdown": "~2.0.0"
"grunt-wp-readme-to-markdown": "~2.0.0",
"qunitjs": "^2.1.1"
}
}
Loading

0 comments on commit b21a288

Please sign in to comment.