Skip to content

Commit

Permalink
add form to wp_kses_allowed_html and fix unit tests (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfocht committed Dec 14, 2018
1 parent ed2e432 commit 734b9e0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
43 changes: 25 additions & 18 deletions includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,31 @@ public function __construct() {

add_filter( 'block_categories', [ $this, 'block_categories' ], 10, 2 );

register_block_type(
'reseller-store/product',
array(
'render_callback' => [
$this,
'product',
],
)
);

register_block_type(
'reseller-store/domain-search',
array(
'render_callback' => [
$this,
'domain_search',
],
)
add_action(
'init',
function() {

register_block_type(
'reseller-store/product',
array(
'render_callback' => [
$this,
'product',
],
)
);

register_block_type(
'reseller-store/domain-search',
array(
'render_callback' => [
$this,
'domain_search',
],
)
);

}
);
}

Expand Down
7 changes: 7 additions & 0 deletions includes/widgets/class-widget-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ protected function widget_allowed_html() {
'data-*' => true,
);

$allowed_html['form'] = array(
'role' => true,
'method' => true,
'class' => true,
'action' => true,
);

$data = array(
'data-id' => true,
'data-quantity' => true,
Expand Down
5 changes: 3 additions & 2 deletions tests/test-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ function test_block_instance() {

if ( function_exists( 'register_block_type' ) ) {

$this->assertTrue( wp_script_is( 'reseller-store-block-js' ), 'done' );
$this->assertTrue( wp_script_is( 'reseller-store-blocks-js' ), 'done' );
$this->assertTrue( wp_style_is( 'reseller-store-blocks-css' ), 'done' );

} else {

$this->assertFalse( wp_script_is( 'reseller-store-block-js' ), 'done' );
$this->assertFalse( wp_script_is( 'reseller-store-blocks-js' ), 'done' );
$this->assertFalse( wp_style_is( 'reseller-store-blocks-css' ), 'done' );

}
Expand All @@ -51,6 +51,7 @@ function test_block_enqueue_function() {

$blocks->enqueue_block_editor_assets();

$this->assertTrue( wp_script_is( 'reseller-store-blocks-js' ), 'done' );
$this->assertTrue( wp_style_is( 'reseller-store-blocks-css' ), 'done' );

}
Expand Down

0 comments on commit 734b9e0

Please sign in to comment.