Mange / roadie

Compare b9270f0 ... +0 ... 0b2cbaf

Coverage Reach
spec/lib/roadie/document_spec.rb spec/lib/roadie/inliner_spec.rb spec/lib/roadie/asset_scanner_spec.rb spec/lib/roadie/net_http_provider_spec.rb spec/lib/roadie/url_generator_spec.rb spec/lib/roadie/provider_list_spec.rb spec/lib/roadie/url_rewriter_spec.rb spec/lib/roadie/filesystem_provider_spec.rb spec/lib/roadie/markup_improver_spec.rb spec/lib/roadie/cached_provider_spec.rb spec/lib/roadie/style_property_spec.rb spec/lib/roadie/selector_spec.rb spec/lib/roadie/stylesheet_spec.rb spec/lib/roadie/style_block_spec.rb spec/lib/roadie/path_rewriter_provider_spec.rb spec/lib/roadie/style_attribute_builder_spec.rb spec/lib/roadie/utils_spec.rb spec/lib/roadie/test_provider_spec.rb spec/lib/roadie/css_not_found_spec.rb spec/lib/roadie/null_provider_spec.rb spec/lib/roadie/null_url_rewriter_spec.rb spec/lib/roadie/deduplicator_spec.rb spec/integration_spec.rb spec/support/have_styling_matcher.rb spec/support/have_attribute_matcher.rb spec/support/have_node_matcher.rb spec/support/test_provider.rb spec/support/have_xpath_matcher.rb spec/support/have_selector_matcher.rb spec/shared_examples/url_rewriter.rb spec/shared_examples/asset_provider.rb lib/roadie/inliner.rb lib/roadie/document.rb lib/roadie/url_generator.rb lib/roadie/net_http_provider.rb lib/roadie/markup_improver.rb lib/roadie/errors.rb lib/roadie/rspec/asset_provider.rb lib/roadie/rspec/cache_store.rb lib/roadie/asset_scanner.rb lib/roadie/provider_list.rb lib/roadie/stylesheet.rb lib/roadie/selector.rb lib/roadie/style_property.rb lib/roadie/deduplicator.rb lib/roadie/url_rewriter.rb lib/roadie/filesystem_provider.rb lib/roadie/style_block.rb lib/roadie/cached_provider.rb lib/roadie/path_rewriter_provider.rb lib/roadie/utils.rb lib/roadie/style_attribute_builder.rb lib/roadie/null_provider.rb lib/roadie/null_url_rewriter.rb lib/roadie/asset_provider.rb lib/roadie/rspec.rb lib/roadie.rb

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -142,6 +142,7 @@
Loading
142 142
    # Valid modes:
143 143
    #   `:html` (default)
144 144
    #   `:xhtml`
145 +
    #   `:xml`
145 146
    def mode=(mode)
146 147
      if VALID_MODES.include?(mode)
147 148
        @mode = mode
@@ -151,7 +152,7 @@
Loading
151 152
    end
152 153
153 154
    private
154 -
    VALID_MODES = %i[html xhtml].freeze
155 +
    VALID_MODES = %i[html xhtml xml].freeze
155 156
    private_constant :VALID_MODES
156 157
157 158
    def stylesheet
@@ -182,6 +183,7 @@
Loading
182 183
      format = {
183 184
        html: save_options::AS_HTML,
184 185
        xhtml: save_options::AS_XHTML,
186 +
        xml: save_options::AS_XML,
185 187
      }.fetch(mode)
186 188
187 189
      dom.dup.to_html(

@@ -70,6 +70,9 @@
Loading
70 70
71 71
      document.mode = :html
72 72
      expect(document.mode).to eq(:html)
73 +
74 +
      document.mode = :xml
75 +
      expect(document.mode).to eq(:xml)
73 76
    end
74 77
75 78
    it "does not allow unknown modes" do
@@ -126,6 +129,21 @@
Loading
126 129
          expect(document.transform).to include("{{hello}}")
127 130
        end
128 131
      end
132 +
133 +
      context "in XML mode" do
134 +
        it "doesn't replace empty tags with self-closed ones" do
135 +
          document = Document.new "<img src='https://google.com/image.png'></img>"
136 +
          document.mode = :xml
137 +
138 +
          expect(document.transform_partial).to end_with('</img>')
139 +
        end
140 +
141 +
        it "does not escape curly braces" do
142 +
          document = Document.new "<a href='https://google.com/{{hello}}'>Hello</a>"
143 +
          document.mode = :xhtml
144 +
          expect(document.transform_partial).to include("{{hello}}")
145 +
        end
146 +
      end
129 147
    end
130 148
131 149
    describe "partial transforming" do
@@ -159,6 +177,21 @@
Loading
159 177
          expect(document.transform_partial).to include("{{hello}}")
160 178
        end
161 179
      end
180 +
181 +
      context "in XML mode" do
182 +
        it "doesn't replace empty tags with self-closed ones" do
183 +
          document = Document.new "<img src='https://google.com/image.png'></img>"
184 +
          document.mode = :xml
185 +
186 +
          expect(document.transform_partial).to end_with('</img>')
187 +
        end
188 +
189 +
        it "does not escape curly braces" do
190 +
          document = Document.new "<a href='https://google.com/{{hello}}'>Hello</a>"
191 +
          document.mode = :xhtml
192 +
          expect(document.transform_partial).to include("{{hello}}")
193 +
        end
194 +
      end
162 195
    end
163 196
  end
164 197

Learn more Showing 15 files with coverage changes found.

Changes in spec/lib/roadie/css_not_found_spec.rb
-1
+1
Loading file...
Changes in spec/integration_spec.rb
+6
Loading file...
Changes in lib/roadie/asset_scanner.rb
+1
+1
Loading file...
Changes in spec/lib/roadie/document_spec.rb
+1
+2
Loading file...
Changes in lib/roadie/selector.rb
New
Loading file...
Changes in spec/lib/roadie/selector_spec.rb
-1
Loading file...
Changes in spec/lib/roadie/inliner_spec.rb
-1
+1
Loading file...
Changes in spec/lib/roadie/filesystem_provider_spec.rb
-1
+1
Loading file...
Changes in spec/lib/roadie/url_generator_spec.rb
-4
+4
Loading file...
Changes in spec/lib/roadie/provider_list_spec.rb
-4
+4
Loading file...
Changes in lib/roadie/rspec/cache_store.rb
-1
+1
Loading file...
Changes in spec/lib/roadie/net_http_provider_spec.rb
-6
+6
Loading file...
Changes in spec/lib/roadie/path_rewriter_provider_spec.rb
-2
+2
Loading file...
Changes in spec/lib/roadie/null_url_rewriter_spec.rb
-1
+1
Loading file...
Changes in spec/lib/roadie/cached_provider_spec.rb
-3
+3
Loading file...
Files Coverage
lib +<.01% 98.64%
spec +1.10% 96.47%
Project Totals (57 files) 97.25%
Loading