generated from jrtashjian/pluginwp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d12786
commit c9318fc
Showing
12 changed files
with
442 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Tests the Button class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Button; | ||
|
||
/** | ||
* Tests the Button class. | ||
*/ | ||
class ButtonTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new ButtonBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the buttonLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_button_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->assertNotEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'buttonLabel' => 'button label', | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class ButtonBlock extends Button { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Tests the Captcha class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Captcha; | ||
|
||
/** | ||
* Tests the Captcha class. | ||
*/ | ||
class CaptchaTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new CaptchaBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the service attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_service() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->assertNotEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'service' => 'hcaptcha', | ||
) | ||
) | ||
); | ||
|
||
$this->assertEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'service' => 'none-existant-service', | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class CaptchaBlock extends Captcha { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Tests the Field class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Field; | ||
|
||
/** | ||
* Tests the Field class. | ||
*/ | ||
class FieldTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new FieldBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the fieldLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_field_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->assertNotEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'fieldLabel' => 'field label', | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class FieldBlock extends Field { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Tests the Fieldset class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Fieldset; | ||
|
||
/** | ||
* Tests the Fieldset class. | ||
*/ | ||
class FieldsetTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new FieldsetBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the fieldLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_field_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->assertNotEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'fieldLabel' => 'field label', | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class FieldsetBlock extends Fieldset { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Tests the Input class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Input; | ||
|
||
/** | ||
* Tests the Input class. | ||
*/ | ||
class InputTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new InputBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the fieldLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_field_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->apply_block_context( 'omniform/fieldLabel', 'field label' ); | ||
$this->assertNotEmpty( $this->render_block_with_attributes() ); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class InputBlock extends Input { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Tests the Label class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\Label; | ||
|
||
/** | ||
* Tests the Label class. | ||
*/ | ||
class LabelTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new LabelBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the fieldLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_field_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->apply_block_context( 'omniform/fieldLabel', 'field label' ); | ||
$this->assertNotEmpty( $this->render_block_with_attributes() ); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class LabelBlock extends Label { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Tests the SelectGroup class. | ||
* | ||
* @package OmniForm | ||
*/ | ||
|
||
namespace OmniForm\Tests\BlockLibrary\Blocks; | ||
|
||
use OmniForm\BlockLibrary\Blocks\SelectGroup; | ||
|
||
/** | ||
* Tests the SelectGroup class. | ||
*/ | ||
class SelectGroupTest extends FormBlockTestCase { | ||
/** | ||
* Register the block to test against. | ||
*/ | ||
public function set_up() { | ||
$this->register_block_type( new SelectGroupBlock() ); | ||
} | ||
|
||
/** | ||
* Make sure the block does not render markup if the fieldLabel attribute is empty. | ||
*/ | ||
public function test_does_not_render_without_field_label() { | ||
$this->assertEmpty( $this->render_block_with_attributes() ); | ||
|
||
$this->assertNotEmpty( | ||
$this->render_block_with_attributes( | ||
array( | ||
'fieldLabel' => 'field label', | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
// phpcs:disable | ||
class SelectGroupBlock extends SelectGroup { | ||
public function block_type_metadata() { | ||
return 'omniform/' . $this->block_type_name(); | ||
} | ||
} |
Oops, something went wrong.