1<?php 2 3require_once(__DIR__ . '/../webcomponent.php'); 4/** 5 * Test the component plugin 6 * 7 * @group plugin_webcomponent 8 * @group plugins 9 */ 10class plugin_webcomponent_cardcolumns_test extends DokuWikiTest 11{ 12 13 protected $pluginsEnabled = [webcomponent::PLUGIN_NAME]; 14 15 16 public function test_component_name() { 17 18 $componentNames = syntax_plugin_webcomponent_cardcolumns::getTags(); 19 $tags = array ( 20 'card-columns', 21 'teaser-columns' 22 ); 23 $this->assertEquals($tags, $componentNames); 24 25 } 26 27 public function test_base() { 28 29 $componentName = syntax_plugin_webcomponent_cardcolumns::getTags()[0]; 30 $doku_text = '<'. $componentName .'>'.DOKU_LF. 31 '<'.syntax_plugin_webcomponent_card::getTag().' style="width: 18rem;">'.DOKU_LF. 32 '===== Title ====='.DOKU_LF. 33 'Teaser Text'.DOKU_LF. 34 '</'.syntax_plugin_webcomponent_card::getTag().'>'.DOKU_LF. 35 '</'.$componentName.'>'; 36 37 $info = array(); 38 39 $instructions = p_get_instructions($doku_text); 40 $xhtml = p_render('xhtml', $instructions, $info); 41 42 $expected = '<div class="card-columns">'.DOKU_LF. 43 '<div class="card" style="width: 18rem;">'.DOKU_LF. 44 DOKU_TAB.'<div class="card-body">'.DOKU_LF. 45 DOKU_TAB.DOKU_TAB.'<h2 class="card-title">Title</h2>'.DOKU_LF. 46 DOKU_TAB.DOKU_TAB.'<p class="card-text">Teaser Text</p>'.DOKU_LF. 47 DOKU_TAB.'</div>'.DOKU_LF. 48 '</div>'.DOKU_LF. 49 '</div>'.DOKU_LF; 50 51 52 $this->assertEquals($expected, $xhtml); 53 54 } 55 56 57 58 59 60} 61