Skip to content

Commit

Permalink
Merge pull request #557 from xwp/main
Browse files Browse the repository at this point in the history
Merge main
  • Loading branch information
derekherman committed Mar 10, 2021
2 parents 64c7f9f + e287699 commit 63d7141
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 34 deletions.
12 changes: 12 additions & 0 deletions assets/css/src/block-editor.css
Expand Up @@ -56,3 +56,15 @@
.block-editor-block-list__block .material-design-block-handpicked-posts__selection {
width: 100%;
}

.mdc-image-list--with-text-protection .mdc-image-list__supporting {
align-items: start;
height: auto;
max-height: 100%;
min-height: 48px;
padding: 8px 16px;
}

.mdc-image-list__label {
white-space: normal;
}
9 changes: 9 additions & 0 deletions assets/css/src/components/material.css
Expand Up @@ -127,8 +127,17 @@
}

.mdc-image-list--with-text-protection .mdc-image-list__supporting {
align-items: start;
border-bottom-left-radius: var(--mdc-image-list-radius, 4px);
border-bottom-right-radius: var(--mdc-image-list-radius, 4px);
height: auto;
max-height: 100%;
min-height: 48px;
padding: 8px 16px;
}

.mdc-image-list__label {
white-space: normal;
}

.mdc-image-list__image-aspect-container .mdc-image-list__image {
Expand Down
2 changes: 1 addition & 1 deletion material-design.php
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Material Design
* Plugin URI: https://github.com/xwp/material-design-wp-plugin
* Description: The official Material Design plugin for WordPress. Customize your site’s navigation, colors, typography, and shapes, use Material Components, and choose from over 1,000 Google Fonts and Material Design icons. From the team behind Google’s open-source design system.
* Version: 0.1.0
* Version: 0.1.1
* Author: Material Design
* Author URI: http://material.io
* License: Apache License, Version 2.0
Expand Down
54 changes: 29 additions & 25 deletions php/class-importer.php
Expand Up @@ -155,27 +155,33 @@ public function import_terms() {
* @return void
*/
public function add_menu_items() {
$menu_name = esc_html__( 'Importer Primary', 'material-design' );
wp_delete_nav_menu( $menu_name );

$menu_id = wp_create_nav_menu( $menu_name );
$menu_items = $this->get_menu_items();

foreach ( $menu_items as $menu_item ) {
$page = Helpers::get_page_by_title( $menu_item );
$page_id = ! empty( $page ) ? $page->ID : null;

wp_update_nav_menu_item(
$menu_id,
0,
[
'menu-item-title' => $menu_item,
'menu-item-status' => 'publish',
'menu-item-object' => 'page',
'menu-item-object-id' => $page->ID,
'menu-item-type' => 'post_type',
]
);
$menus = get_terms( 'nav_menu', [ 'hide_empty' => true ] );

if ( ! empty( $menus ) && ! empty( $menus[0] ) ) {
$menu_id = $menus[0]->term_id;
} else {
$menu_name = esc_html__( 'Importer Primary', 'material-design' );
wp_delete_nav_menu( $menu_name );

$menu_id = wp_create_nav_menu( $menu_name );
$menu_items = $this->get_menu_items();

foreach ( $menu_items as $menu_item ) {
$page = Helpers::get_page_by_title( $menu_item );
$page_id = ! empty( $page ) ? $page->ID : null;

wp_update_nav_menu_item(
$menu_id,
0,
[
'menu-item-title' => $menu_item,
'menu-item-status' => 'publish',
'menu-item-object' => 'page',
'menu-item-object-id' => $page->ID,
'menu-item-type' => 'post_type',
]
);
}
}

$menu_locations = get_theme_mod( 'nav_menu_locations' );
Expand Down Expand Up @@ -630,16 +636,14 @@ public function update_blog_info() {

set_theme_mod( 'material_header_search_display', true );

if ( $home_page ) {
if ( $home_page && empty( get_option( 'page_on_front' ) ) ) {
update_option( 'page_on_front', $home_page->ID );
update_option( 'show_on_front', 'page' );
}

if ( $blog_page ) {
if ( $blog_page && empty( get_option( 'page_for_posts' ) ) ) {
update_option( 'page_for_posts', $blog_page->ID );
}

set_theme_mod( 'material_header_search_display', true );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion php/class-plugin-base.php
Expand Up @@ -184,7 +184,7 @@ public function locate_plugin() {
}

$plugin_dir = dirname( dirname( $file_name ) );
$plugin_path = $this->relative_path( $plugin_dir, basename( content_url() ), \DIRECTORY_SEPARATOR );
$plugin_path = $this->relative_path( $plugin_dir, basename( content_url() ), '/' );

$dir_url = content_url( trailingslashit( $plugin_path ) );
$dir_path = $plugin_dir;
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -7,7 +7,7 @@ The official Material Design plugin for WordPress. Customize your site’s navig
**Contributors:** [google](https://profiles.wordpress.org/google), [materialdesign](https://profiles.wordpress.org/materialdesign), [xwp](https://profiles.wordpress.org/xwp)
**Requires at least:** 5.2
**Tested up to:** 5.6
**Stable tag:** 0.1.0
**Stable tag:** 0.1.1
**License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)

[![Build Status](https://travis-ci.com/xwp/material-design-wp-plugin.svg?branch=develop)](https://travis-ci.com/xwp/material-design-wp-plugin) [![Coverage Status](https://coveralls.io/repos/xwp/material-design-wp-plugin/badge.svg?branch=develop)](https://coveralls.io/github/xwp/material-design-wp-plugin) [![Built with Grunt](https://gruntjs.com/cdn/builtwith.svg)](http://gruntjs.com)
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Expand Up @@ -2,7 +2,7 @@
Contributors: google, materialdesign, xwp
Requires at least: 5.2
Tested up to: 5.6
Stable tag: 0.1.0
Stable tag: 0.1.1
License: Apache License, Version 2.0
License URI: https://www.apache.org/licenses/LICENSE-2.0

Expand Down
17 changes: 13 additions & 4 deletions tests/e2e/specs/block-editor/blocks/tab-bar/tab-bar.spec.js
Expand Up @@ -179,7 +179,7 @@ describe( 'blocks: material/tab-bar', () => {
).toHaveLength( 0 );
} );

it( 'should not offer tab-bar as a block option within another Tabss content', async () => {
it( 'should not offer tab-bar as a block option within another Tabs content', async () => {
await insertBlock( 'Tabs' );
await selectBlockByName( 'material/tab-bar' );

Expand All @@ -191,8 +191,17 @@ describe( 'blocks: material/tab-bar', () => {
const [ searchBlock ] = await page.$$( '.block-editor-inserter__search' );
await searchBlock.type( 'Tabs' );

expect(
await page.$$( '.block-editor-inserter__no-results' )
).toHaveLength( 1 );
try {
expect(
await page.$$( '.block-editor-inserter__no-results' )
).toHaveLength( 1 );
} catch ( ex ) {
// eslint-disable-next-line jest/no-try-expect
expect(
await page.$$(
'.block-editor-block-types-list__item editor-block-list-item-material-tab-bar'
)
).toHaveLength( 0 );
}
} );
} );
2 changes: 1 addition & 1 deletion tests/e2e/specs/customizer/shape-size.spec.js
Expand Up @@ -145,7 +145,7 @@ describe( 'Customize controls: Shape Size (Corner Styles)', () => {

let globalRadius = await moveRangeSlider( sliders[ 0 ], 0.25 );
const buttonRadius = await moveRangeSlider( sliders[ 1 ], 0.5 );
const dataTableRadius = await moveRangeSlider( sliders[ 4 ], 1 );
const dataTableRadius = await moveRangeSlider( sliders[ 4 ], 0.95 );

expect(
await page.evaluate( el => {
Expand Down

0 comments on commit 63d7141

Please sign in to comment.