emcee 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,10 @@ require 'emcee/document'
9
9
  class ResolverStub
10
10
  attr_reader :asset_required
11
11
 
12
+ def initialize(contents)
13
+ @contents = contents
14
+ end
15
+
12
16
  def absolute_path(path)
13
17
  "/#{path}"
14
18
  end
@@ -18,7 +22,7 @@ class ResolverStub
18
22
  end
19
23
 
20
24
  def evaluate(path)
21
- "/* contents */"
25
+ @contents
22
26
  end
23
27
 
24
28
  def should_inline?(path)
@@ -28,7 +32,7 @@ end
28
32
 
29
33
  class ProcessorsTest < ActiveSupport::TestCase
30
34
  setup do
31
- @resolver = ResolverStub.new
35
+ @resolver = ResolverStub.new "/* contents */"
32
36
  @body = <<-EOS.strip_heredoc
33
37
  <link rel="import" href="test.html">
34
38
  <link rel="stylesheet" href="test.css">
@@ -79,4 +83,37 @@ class ProcessorsTest < ActiveSupport::TestCase
79
83
 
80
84
  assert_equal correct, processed
81
85
  end
86
+
87
+ test "processing scripts escapes </script>" do
88
+ @resolver = ResolverStub.new "// </script>"
89
+
90
+ processor = Emcee::Processors::ScriptProcessor.new(@resolver)
91
+ processed = processor.process(@doc).to_s
92
+
93
+ correct = <<-EOS.strip_heredoc
94
+ <link rel="import" href="test.html">
95
+ <link rel="stylesheet" href="test.css">
96
+ <script>// <\\/script></script>
97
+ <p>test</p>
98
+ EOS
99
+
100
+ assert_equal correct, processed
101
+ end
102
+
103
+ test "processing scripts escapes <!--" do
104
+ @resolver = ResolverStub.new "// <!--"
105
+
106
+ processor = Emcee::Processors::ScriptProcessor.new(@resolver)
107
+ processed = processor.process(@doc).to_s
108
+
109
+ correct = <<-EOS.strip_heredoc
110
+ <link rel="import" href="test.html">
111
+ <link rel="stylesheet" href="test.css">
112
+ <script>// <!\\--</script>
113
+ <p>test</p>
114
+ EOS
115
+
116
+ assert_equal correct, processed
117
+ end
82
118
  end
119
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emcee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Huth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-01 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri