Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/unit/processor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,26 @@ def test_behaviour_processor_minify
assert(File.exists?('file.css'))
end

# Test that /*! comments are maintained in the output of YUI
def test_preserve_comments_in_css
preserved_comment = '/*! This comment remains */'
removed_comment = '/* This comment is removed */'

["file.js", "file.css"].each do |tmp_file|
File.open(tmp_file, 'w') do |tmp_file|
tmp_file.write(preserved_comment)
tmp_file.write(removed_comment)
end

assert_match /remains/, File.read(@processor.minify_file(tmp_file, nil)), "/*! should be preserved by Yuicompressor"
assert_no_match /removed/, File.read(@processor.minify_file(tmp_file, nil)), "/* should be removed by Yuicompressor"
end

end

def teardown
File.delete('file.css') if File.exists?('file.css')
File.delete('file.min.css') if File.exists?('file.min.css')
File.delete('file.js') if File.exists?('file.js')
end
end