1 common.test CommonCascadingStylesheetsTestCase::testRenderRemoveCharsetPreprocess()

Tests removing charset when rendering stylesheets with preprocessing on.

File

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

Class

CommonCascadingStylesheetsTestCase
Test the Backdrop 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'], 
    backdrop_load_stylesheet_content($case['asset']), 
    'CSS optimizing correctly removes the charset declaration.'
    );
  }
}