/** * @test */ public function createsRepeatContentArea() { $html = <<<'END' <html> <body> <div data-repeatable="repeat1"> <div data-edit="article" data-type="textarea"></div> </div> </body> </html> END; $tm = new TemplateModel(); $tm->loadHtml($html); $node = $tm->namedNode('repeat1'); $area = ContentAreaBase::createContentArea($node); $this->assertInstanceOf('phpList\\plugin\\ContentAreas\\ContentAreaRepeat', $area); $this->assertEquals('repeat1', $area->name); $this->assertEquals('repeat1', $area->reference); }
/** * @test */ public function mergesTemplateWithMessageEdit() { $_GET['pi'] = 'ContentAreas'; $_GET['page'] = 'message_page'; $template = '<html><head></head><body><div data-edit="article"></div></body></html>'; $tm = new TemplateModel(); $tm->loadHtml($template); $result = $tm->merge(['article' => '<p>here is the article</p>'], true); $expectedEdit = '<a class="opendialog" href="./?page=message_page&pi=ContentAreas&field=article&action=edit" title="article"><img src="./?page=image&pi=CommonPlugin&image=pencil.png" alt="Edit" title="Edit"></a>'; $this->assertContains($expectedEdit, $result); $expectedId = '<div class="editable" id="article">'; $this->assertContains($expectedId, $result); }