public function testRender() { $html = new CM_Dom_NodeList(smarty_function_menu(['data' => $this->_menuData, 'activePage' => new CM_Page_Example(['foo' => 1])], $this->_template)); $this->assertContains('menu', $html->getAttribute('class')); $this->assertCount(2, $html->find('> li')); }
public function testLoadComponent() { $response = $this->getResponseAjax(new CM_Component_Graph(), 'loadComponent', ['className' => 'CM_Component_Graph', 'series' => []]); $this->assertViewResponseSuccess($response); $successContent = CM_Params::decode($response->getContent(), true)['success']; $autoId = $successContent['data']['autoId']; $this->assertNotEmpty($autoId); $html = new CM_Dom_NodeList($successContent['data']['html']); $this->assertSame($autoId, $html->getAttribute('id')); $this->assertArrayNotHasKey('exec', $successContent); $this->assertContains('new CM_Component_Graph', $successContent['data']['js']); }
public function testGetAttribute() { $list = new CM_Dom_NodeList('<div class="outer"><div foo="bar"><div foo="foo"></div></div></div>'); $this->assertSame('bar', $list->find('div')->getAttribute('foo')); $this->assertNull($list->getAttribute('bar')); }