Exemple #1
0
 /**
  * @covers generateCss
  */
 public function testGenerateCss()
 {
     $env = new Context();
     $output = new StandardOutput();
     $r = new RuleNode('foobar', new AnonymousNode('yellow'));
     $r->generateCss($env, $output);
     $this->assertEquals('foobar: yellow;', $output->toString());
 }
Exemple #2
0
 /**
  * @covers generateCss
  */
 public function testGenerateCss()
 {
     $env = new Context();
     $output = new StandardOutput();
     $r = new RulesetNode([new SelectorNode([new ElementNode('', 'div')])], [new RuleNode('color', new ColorNode('#fff')), new RuleNode('font-weight', new KeywordNode('bold'))]);
     $args = new VisitorArguments(['visitDeeper' => true]);
     $visitor = new JoinSelectorVisitor();
     $visitor->visitRuleset($r, $args);
     $n = new RuleNode('font-weight', new KeywordNode('bold'));
     $n->generateCss($env, $output);
     $this->assertEquals('font-weight: bold;', $output->toString());
     $output = new StandardOutput();
     $r->generateCss($env, $output);
     $expected = "div {\n  color: #ffffff;\n  font-weight: bold;\n}";
     $this->assertEquals($expected, $output->toString());
 }