File tree Expand file tree Collapse file tree 4 files changed +26
-8
lines changed
spec/app/aspects/extensions/renderers Expand file tree Collapse file tree 4 files changed +26
-8
lines changed Original file line number Diff line number Diff line change 77 default = TRMNL ::Liquid . new { |environment | environment . error_mode = :strict }
88
99 renderer = lambda do |template , data , environment : default |
10- Liquid ::Template . parse ( template , environment :) . render data
10+ slice [ "aspects.sanitizer" ] . call Liquid ::Template . parse ( template , environment :) . render ( data )
1111 end
1212
1313 register :default , renderer
Original file line number Diff line number Diff line change 2020 it "renders template with single URI" do
2121 expect ( renderer . call ( extension , context :) ) . to be_success (
2222 Terminus ::Aspects ::Extensions ::Capsule [
23- content : %(<img src="https://test.io/test.png" alt="Image">)
23+ content : <<~CONTENT . strip
24+ <html><head></head><body><img src="https://test.io/test.png" alt="Image"></body></html>
25+ CONTENT
2426 ]
2527 )
2628 end
3537
3638 expect ( renderer . call ( extension , context :) ) . to be_success (
3739 Terminus ::Aspects ::Extensions ::Capsule [
38- content : <<~CONTENT
39- <img src="https://test.io/one.png" alt="Image">
40+ content : <<~CONTENT . strip
41+ <html><head></head><body>< img src="https://test.io/one.png" alt="Image">
4042 <img src="https://test.io/two.png" alt="Image">
43+ </body></html>
4144 CONTENT
4245 ]
4346 )
Original file line number Diff line number Diff line change 4242
4343 expect ( renderer . call ( extension , context :) ) . to be_success (
4444 Terminus ::Aspects ::Extensions ::Capsule [
45- content : %(<h1>Test Label</h1>\n \n <p>Test: A test.</p>\n \n )
45+ content : <<~CONTENT . strip
46+ <html><head></head><body><h1>Test Label</h1>
47+
48+ <p>Test: A test.</p>
49+
50+ </body></html>
51+ CONTENT
4652 ]
4753 )
4854 end
6773 end
6874
6975 it "answers render template and captures errors" do
70- html = <<~CONTENT
71- <h1>Test Label</h1>
76+ html = <<~CONTENT . strip
77+ <html><head></head><body>< h1>Test Label</h1>
7278 <p>Test</p>
7379
7480 <p>Test</p>
81+ </body></html>
7582 CONTENT
7683
7784 expect ( renderer . call ( extension , context :) ) . to be_failure (
Original file line number Diff line number Diff line change 3030
3131 expect ( renderer . call ( extension , context :) ) . to be_success (
3232 Terminus ::Aspects ::Extensions ::Capsule [
33- content : %(<h1>Days</h1>\n \n <p>One</p>\n \n <p>Two</p>\n \n )
33+ content : <<~CONTENT . strip
34+ <html><head></head><body><h1>Days</h1>
35+
36+ <p>One</p>
37+
38+ <p>Two</p>
39+
40+ </body></html>
41+ CONTENT
3442 ]
3543 )
3644 end
You can’t perform that action at this time.
0 commit comments