# HTML Sanitisation Test Cases This file is in markdown not python for readability. Each test is a level 2 heading. The input and expected values are level 3 headings. The HTML to test is in triple backtick code blocks. Anything not in code blocks is a comment. This file is run by /tests/unit_tests/test_ui.py ## Test scripts removed The script is removed but the contents remain. ### Input ```html

Hello

``` ### Result ```html alert("x") Hello ``` ## Test script in bold tag ### Input ```html click me! ``` ### Result ```html click me! ``` ## Test script in disallowed tag ### Input ```html ``` ### Result ```html ``` ## Test cookie grabber script is escaped The script should become escaped and have no tags ### Input ```html ``` ### Result ```html var adr = '../evil.php?cakemonster=' + escape(document.cookie); ``` ## Test with non-http links Remove the javascript from the links. ### Input ```html link encoded Email Relative ``` ### Result ```html link encoded Email Relative ``` ## Test http links become external Remove the javascript from the links. ### Input ```html OpenFlexure ``` ### Result ```html OpenFlexure ``` ## Test basic formatting preserved Check basic elements are not changed ### Input ```html This is bold italic and on a new
line. ``` ### Result ```html This is bold italic and on a new
line. ``` ## Test http link with path preserved Valid HTTP links should preserve their path. ### Input ```html Docs ``` ### Result ```html Docs ``` ## Test http link with fragment preserved Valid HTTP links should preserve their path and fragment. ### Input ```html Docs Section ``` ### Result ```html Docs Section ```