Beispiel #1
0
    function testReplaceImgSnippet()
    {
        $he = new Hamle\Hamle($this->model(), new snippetReplaceImgSetup());
        $hamle = "html\n" . "  head\n" . "    title \$titlebar\n" . "  body\n" . "    |each\n" . "      .enlarge\n" . "        img[src={\$url}/thumb&alt=\$alt]\n" . "    div\n" . "      .two.find1\n" . "        .stuff\n" . "          .more-stuff\n" . "            .find2\n" . "              .gone\n";
        $html = <<<TESTHTML
<html>
  <head>
    <title>My Page</title>
    <script type="text/javascript" src="/js/lightbox"></script>
  </head>
  <body>
    <div class="enlarge">
      <a href="#" onclick="enlarge('imgid')" data-img="/img/1">
        <img src="/img/1/thumb" alt="My Image #1" />
      </a>
    </div>
    <div class="enlarge">
      <a href="#" onclick="enlarge('imgid')" data-img="/img/2">
        <img src="/img/2/thumb" alt="My Image #2" />
      </a>
    </div>
    <div>
      <div class="two find1">
        <div class="stuff">
          <div class="more-stuff">
            <div class="found">Hi There</div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
TESTHTML;
        $he->string($hamle);
        $out = $he->output();
        $this->assertEquals(trim($html), trim($out));
        $this->compareXmlStrings($html, $out);
    }