示例#1
0
 /**
  * @group ZF-9532
  */
 public function testRenderConditionalCommentsShouldNotContainHtmlEscaping()
 {
     $style = 'a{display:none;}';
     $this->helper->appendStyle($style, array('conditional' => 'IE 8'));
     $value = $this->helper->toString();
     $this->assertNotContains('<!--' . PHP_EOL, $value);
     $this->assertNotContains(PHP_EOL . '-->', $value);
 }
示例#2
0
 /**
  * @issue ZF-5435
  */
 public function testContainerMaintainsCorrectOrderOfItems()
 {
     $style1 = 'a {display: none;}';
     $this->helper->offsetSetStyle(10, $style1);
     $style2 = 'h1 {font-weight: bold}';
     $this->helper->offsetSetStyle(5, $style2);
     $test = $this->helper->toString();
     $expected = '<style type="text/css" media="screen">' . PHP_EOL . '<!--' . PHP_EOL . $style2 . PHP_EOL . '-->' . PHP_EOL . '</style>' . PHP_EOL . '<style type="text/css" media="screen">' . PHP_EOL . '<!--' . PHP_EOL . $style1 . PHP_EOL . '-->' . PHP_EOL . '</style>';
     $this->assertEquals($expected, $test);
 }
    /**
     * @group GH-515
     */
    public function testConditionalScriptNoIEWidthSpace()
    {
        $this->helper->appendStyle('
a {
    display: none;
}', array('media' => 'screen,projection', 'conditional' => '! IE'));
        $test = $this->helper->toString();
        $this->assertContains('<!--[if ! IE]><!--><', $test);
        $this->assertContains('<!--<![endif]-->', $test);
    }
示例#4
0
 public function testNestedCapturingFails()
 {
     $this->helper->headStyle()->captureStart();
     echo "Captured text";
     try {
         $this->helper->headStyle()->captureStart();
         $this->helper->headStyle()->captureEnd();
         $this->fail('Nested capturing should fail');
     } catch (Zend_View_Exception $e) {
         $this->helper->headStyle()->captureEnd();
         $this->assertContains('Cannot nest', $e->getMessage());
     }
     $this->helper->headStyle()->captureEnd();
 }
    public function testIndentationIsHonored()
    {
        $this->helper->setIndent(4);
        $this->helper->appendStyle('
a {
    display: none;
}');
        $this->helper->appendStyle('
h1 {
    font-weight: bold
}');
        $string = $this->helper->toString();

        $scripts = substr_count($string, '    <style');
        $this->assertEquals(2, $scripts);
        $this->assertContains('    <!--', $string);
        $this->assertContains('    a {', $string);
        $this->assertContains('    h1 {', $string);
        $this->assertContains('        display', $string);
        $this->assertContains('        font-weight', $string);
        $this->assertContains('    }', $string);
    }