/**
  * @test
  */
 public function findsNamedNode()
 {
     $template = '<html><body><div data-edit="article"></div></body></html>';
     $tm = new TemplateModel();
     $tm->loadHtml($template);
     $this->assertInstanceOf('DOMElement', $tm->namedNode('article'));
 }
    protected function actionEdit()
    {
        $mm = new MessageModel($_GET['id'], $this->dao);
        $row = $this->dao->messageById($_GET['id']);
        $tm = new TemplateModel($this->dao->templateBody($row['template']));
        $ref = Reference::decode(stripslashes($_GET['field']));
        $area = ContentAreaBase::createContentArea($tm->namedNode($ref->name));
        $result = $area->display($ref, $mm->messageAreas());
        $html = <<<END
<html>
<body>{$result}</body>
</html>
END;
        ob_end_clean();
        echo $html;
        exit;
    }
    /**
     * @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);
    }