You are here

function CascadingStylesheetsTestCase::testRenderRemoveCharsetPreprocess in Drupal 7

Tests removing charset when rendering stylesheets with preprocessing on.

File

modules/simpletest/tests/common.test, line 807
Tests for common.inc functionality.

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

function testRenderRemoveCharsetPreprocess() {
  $cases = array(
    array(
      'asset' => '@charset "UTF-8";html{font-family:"sans-serif";}',
      'expected' => 'html{font-family:"sans-serif";}',
    ),
    // This asset contains extra \n character.
    array(
      'asset' => "@charset 'UTF-8';\nhtml{font-family:'sans-serif';}",
      'expected' => "\nhtml{font-family:'sans-serif';}",
    ),
  );
  foreach ($cases as $case) {
    $this
      ->assertEqual($case['expected'], drupal_load_stylesheet_content($case['asset']), 'CSS optimizing correctly removes the charset declaration.');
  }
}