You are here

public function CtoolsCssTestCase::testCssFilterMergeProperties in Chaos Tool Suite (ctools) 7

Test that when the CSS has two properties defined they are merged.

File

tests/css.test, line 95

Class

CtoolsCssTestCase
Test menu links depending on user permissions.

Code

public function testCssFilterMergeProperties() {
  $css = "#some-id {\n  font-size: 12px;\n}\n#some-id {\n  color: blue;\n}";
  $filtered = ctools_css_filter($css);
  $font_size = strpos($filtered, 'font-size:12px;') !== FALSE;
  $color = strpos($filtered, 'color:blue') !== FALSE;
  $this
    ->assertTrue($font_size && $color, 'Multiple properties are merged.');
  $css = '@import url("other.css");p {color: red;}';
  $filtered = ctools_css_filter($css);
  $other_css = strpos($filtered, 'other.css') === FALSE;
  $color = strpos($filtered, 'color:red') !== FALSE;
  $this
    ->assertTrue($other_css && $color, 'CSS is properly sanitized.');
  $css = ';p {color: red; font-size: 12px;}';
  $filtered = ctools_css_filter($css);
  $font_size = strpos($filtered, 'font-size:12px;') !== FALSE;
  $color = strpos($filtered, 'color:red') !== FALSE;
  $this
    ->assertTrue($font_size && $color, 'Multiple properties are retained.');
}