|
1632 | 1632 |
|
1633 | 1633 | context"with HTML embed code for Figma"do |
1634 | 1634 | shared_examples"embed code figma example"do |
1635 | | -let(:markdown)do |
1636 | | -<<-MARKDOWN.strip_heredoc |
1637 | | - <iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="100" height="100" src="#{url}"></iframe> |
1638 | | - MARKDOWN |
1639 | | -end |
1640 | | -let(:url){"#{scheme}//www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com"} |
1641 | | -let(:encoded_url){CGI.escapeHTML(url)} |
| 1635 | +[ |
| 1636 | +"www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com", |
| 1637 | +"embed.figma.com/design/nrPSsILSYjesyc5UHjYYa4?embed_host=share", |
| 1638 | +].eachdo |script_url| |
| 1639 | +context"with HTML embed code for Figma using script url `#{script_url}`"do |
| 1640 | +let(:markdown)do |
| 1641 | +<<-MARKDOWN.strip_heredoc |
| 1642 | + <iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="100" height="100" src="#{url}"></iframe> |
| 1643 | + MARKDOWN |
| 1644 | +end |
1642 | 1645 |
|
1643 | | -ifallowed |
1644 | | -it"does not sanitize embed code"do |
1645 | | -shouldeq<<-HTML.strip_heredoc |
1646 | | -<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100"height="100"src="#{encoded_url}"></iframe> |
1647 | | - HTML |
1648 | | -end |
1649 | | -else |
1650 | | -it"forces width attribute on iframe"do |
1651 | | -shouldeq<<-HTML.strip_heredoc |
1652 | | -<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100%"height="100"src="#{encoded_url}"></iframe> |
1653 | | - HTML |
| 1646 | +let(:url){"#{scheme}//#{script_url}"} |
| 1647 | +let(:encoded_url){CGI.escapeHTML(url)} |
| 1648 | + |
| 1649 | +ifallowed |
| 1650 | +it"does not sanitize embed code"do |
| 1651 | +shouldeq<<-HTML.strip_heredoc |
| 1652 | +<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100"height="100"src="#{encoded_url}"></iframe> |
| 1653 | + HTML |
| 1654 | +end |
| 1655 | +else |
| 1656 | +it"forces width attribute on iframe"do |
| 1657 | +shouldeq<<-HTML.strip_heredoc |
| 1658 | +<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100%"height="100"src="#{encoded_url}"></iframe> |
| 1659 | + HTML |
| 1660 | +end |
| 1661 | +end |
1654 | 1662 | end |
1655 | 1663 | end |
1656 | 1664 | end |
|