@@ -812,6 +812,64 @@ public function testHtmlInsideJavaScriptTemplates()
812
812
static ::assertSame ($ expected , $ htmlMin ->minify ($ html ));
813
813
}
814
814
815
+ public function testOverwriteSpecialScriptTags ()
816
+ {
817
+ $ html = <<<HTML
818
+ <!doctype html>
819
+ <html lang="nl">
820
+ <head></head>
821
+ <body>
822
+ <script type="text/x-custom">
823
+ <ul class="prices-tier items">
824
+ <% _.each(tierPrices, function(item, key) { %>
825
+ <% var priceStr = '<span class="price-container price-tier_price">'
826
+ + '<span data-price-amount="' + priceUtils.formatPrice(item.price, currencyFormat) + '"'
827
+ + ' data-price-type=""' + ' class="price-wrapper ">'
828
+ + '<span class="price">' + priceUtils.formatPrice(item.price, currencyFormat) + '</span>'
829
+ + '</span>'
830
+ + '</span>'; %>
831
+ <li class="item">
832
+ <%= 'some text %1 %2'.replace('%1', item.qty).replace('%2', priceStr) %>
833
+ <strong class="benefit">
834
+ save <span class="percent tier-<%= key %>"> <%= item.percentage %></span>%
835
+ </strong>
836
+ </li>
837
+ <% }); %>
838
+ </ul>
839
+ </script>
840
+ <div data-role="tier-price-block">
841
+ <div> Some Content </div>
842
+ </div>
843
+ </body>
844
+ </html>
845
+ HTML ;
846
+ $ htmlMin = new voku \helper \HtmlMin ();
847
+ $ htmlMin ->overwriteSpecialScriptTags (['text/x-custom ' ]);
848
+ $ expected = <<<HTML
849
+ <!DOCTYPE html><html lang=nl><head> <body><script type=text/x-custom>
850
+ <ul class="prices-tier items">
851
+ <% _.each(tierPrices, function(item, key) { %>
852
+ <% var priceStr = '<span class="price-container price-tier_price">'
853
+ + '<span data-price-amount="' + priceUtils.formatPrice(item.price, currencyFormat) + '"'
854
+ + ' data-price-type=""' + ' class="price-wrapper ">'
855
+ + '<span class="price">' + priceUtils.formatPrice(item.price, currencyFormat) + '</span>'
856
+ + '</span>'
857
+ + '</span>'; %>
858
+ <li class="item">
859
+ <%= 'some text %1 %2'.replace('%1', item.qty).replace('%2', priceStr) %>
860
+ <strong class="benefit">
861
+ save <span class="percent tier-<%= key %>"> <%= item.percentage %></span>%
862
+ </strong>
863
+ </li>
864
+ <% }); %>
865
+ </ul>
866
+ </script> <div data-role=tier-price-block><div> Some Content </div> </div>
867
+ HTML ;
868
+
869
+
870
+ static ::assertSame ($ expected , $ htmlMin ->minify ($ html ));
871
+ }
872
+
815
873
public function testHtmlClosingTagInSpecialScript ()
816
874
{
817
875
$ htmlMin = new \voku \helper \HtmlMin ();
0 commit comments