Skip to content

Commit

Permalink
Create tests for blocks being registered
Browse files Browse the repository at this point in the history
  • Loading branch information
oakesjosh committed Feb 20, 2024
1 parent da07ca3 commit 639fc6c
Show file tree
Hide file tree
Showing 24 changed files with 767 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/wpunit/blocks/AccordionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Tests\wpunit\blocks;
class AccordionTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'accordion';

/**
* Block instance.
*
* @var Kadence_Blocks_Accordion_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Accordion_Block();
}

protected function _after() {
}

public function testIsScriptRegistered() {
$this->block->register_scripts();

$this->assertTrue( wp_script_is( 'kadence-blocks-accordion', 'registered' ), 'Block scripts registered' );
}
}
31 changes: 31 additions & 0 deletions tests/wpunit/blocks/AdvancedBtnTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\wpunit\blocks;
class AdvancedBtnTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'advancedbtn';

/**
* Block instance.
*
* @var \Kadence_Blocks_Advancedbtn_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Advancedbtn_Block();
}

protected function _after() {
}

}
40 changes: 40 additions & 0 deletions tests/wpunit/blocks/AdvancedGalleryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Tests\wpunit\blocks;
class AdvancedGalleryTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'advancedgallery';

/**
* Block instance.
*
* @var \Kadence_Blocks_Advancedbtn_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Advancedgallery_Block();
}

protected function _after() {
}

public function testIsScriptRegistered() {
$this->block->register_scripts();

$this->assertTrue( wp_script_is( 'kad-splide', 'registered' ), 'Splide is registered' );
$this->assertTrue( wp_script_is( 'kadence-blocks-splide-init', 'registered' ), 'Splide init registered' );
$this->assertTrue( wp_script_is( 'kadence-blocks-masonry-init', 'registered' ), 'Masonry init registered' );
$this->assertTrue( wp_script_is( 'kadence-glightbox', 'registered' ), 'Glightbox registered' );
$this->assertTrue( wp_script_is( 'kadence-blocks-glight-init', 'registered' ), 'Glightbox init registered' );
}
}
30 changes: 30 additions & 0 deletions tests/wpunit/blocks/ColumnTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Tests\wpunit\blocks;
class ColumnTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'column';

/**
* Block instance.
*
* @var \Kadence_Blocks_Column_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Column_Block();
}

protected function _after() {
}
}
36 changes: 36 additions & 0 deletions tests/wpunit/blocks/CountdownTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Tests\wpunit\blocks;
class CountdownTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'countdown';

/**
* Block instance.
*
* @var \Kadence_Blocks_Countdown_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Countdown_Block();
}

protected function _after() {
}

public function testIsScriptRegistered() {
$this->block->register_scripts();

$this->assertTrue( wp_script_is( 'kadence-blocks-countdown', 'registered' ), 'Countdown script is registered' );
}
}
37 changes: 37 additions & 0 deletions tests/wpunit/blocks/CountupTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Tests\wpunit\blocks;
class CountupTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'countup';

/**
* Block instance.
*
* @var \Kadence_Blocks_Countup_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Countup_Block();
}

protected function _after() {
}

public function testIsScriptRegistered() {
$this->block->register_scripts();

$this->assertTrue( wp_script_is( 'kadence-countup', 'registered' ), 'Count up library is registered' );
$this->assertTrue( wp_script_is( 'kadence-blocks-countup', 'registered' ), 'Count up script is registered' );
}
}
30 changes: 30 additions & 0 deletions tests/wpunit/blocks/FormTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Tests\wpunit\blocks;
class FormTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'form';

/**
* Block instance.
*
* @var \Kadence_Blocks_Form_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Form_Block();
}

protected function _after() {
}
}
31 changes: 31 additions & 0 deletions tests/wpunit/blocks/GooglemapsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\wpunit\blocks;
class GooglemapsTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'icon';

/**
* Block instance.
*
* @var \Kadence_Blocks_Icon_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Icon_Block();
}

protected function _after() {
}

}
31 changes: 31 additions & 0 deletions tests/wpunit/blocks/IconTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\wpunit\blocks;
class IconTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'googlemaps';

/**
* Block instance.
*
* @var \Kadence_Blocks_Googlemaps_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Googlemaps_Block();
}

protected function _after() {
}

}
31 changes: 31 additions & 0 deletions tests/wpunit/blocks/IconlistTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\wpunit\blocks;
class IconListTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'iconlist';

/**
* Block instance.
*
* @var \Kadence_Blocks_Iconlist_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Iconlist_Block();
}

protected function _after() {
}

}
31 changes: 31 additions & 0 deletions tests/wpunit/blocks/ImageTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tests\wpunit\blocks;
class ImageTest extends \KadenceBlocksUnit {
/**
* @var \WpunitTester
*/
protected $tester;

/**
* Block name.
*
* @var string
*/
protected $block_name = 'image';

/**
* Block instance.
*
* @var \Kadence_Blocks_Image_Block
*/
protected $block;

protected function _before() {
$this->block = new \Kadence_Blocks_Image_Block();
}

protected function _after() {
}

}
Loading

0 comments on commit 639fc6c

Please sign in to comment.