How to use the ariatemplates/utils/String.escapeForHTML function in ariatemplates

To help you get started, we’ve selected a few ariatemplates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testEscapeForHTML : function () {
            var originalString = "<div class="\&quot;class\&quot;">/</div>";
            var escapedForAttrString = "<div class="&quot;class&quot;" id="'id'">/</div>";
            var escapedForHTMLString = "&lt;div id='id' class=\"class\"&gt;/&lt;/div&gt;";
            var escapedForAllString = "&lt;div id='id' class="class"&gt;/&lt;/div&gt;";

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : true
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testEscapeForHTML : function () {
            var originalString = "<div class="\&quot;class\&quot;">/</div>";
            var escapedForAttrString = "<div class="&quot;class&quot;" id="'id'">/</div>";
            var escapedForHTMLString = "&lt;div id='id' class=\"class\"&gt;/&lt;/div&gt;";
            var escapedForAllString = "&lt;div id='id' class="class"&gt;/&lt;/div&gt;";

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : true
            }) === escapedForAttrString, "Full HTML escape failed.");
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
var originalString = "<div class="\&quot;class\&quot;">/</div>";
            var escapedForAttrString = "<div class="&quot;class&quot;" id="'id'">/</div>";
            var escapedForHTMLString = "&lt;div id='id' class=\"class\"&gt;/&lt;/div&gt;";
            var escapedForAllString = "&lt;div id='id' class="class"&gt;/&lt;/div&gt;";

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : true
            }) === escapedForAttrString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : false
            }) === escapedForHTMLString, "Full HTML escape failed.");
        },
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testEscapeForHTML : function () {
            var originalString = "<div class="\&quot;class\&quot;">/</div>";
            var escapedForAttrString = "<div class="&quot;class&quot;" id="'id'">/</div>";
            var escapedForHTMLString = "&lt;div id='id' class=\"class\"&gt;/&lt;/div&gt;";
            var escapedForAllString = "&lt;div id='id' class="class"&gt;/&lt;/div&gt;";

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : true
            }) === escapedForAttrString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : false
            }) === escapedForHTMLString, "Full HTML escape failed.");
        },
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testEscapeForHTML : function () {
            var originalString = "<div class="\&quot;class\&quot;">/</div>";
            var escapedForAttrString = "<div class="&quot;class&quot;" id="'id'">/</div>";
            var escapedForHTMLString = "&lt;div id='id' class=\"class\"&gt;/&lt;/div&gt;";
            var escapedForAllString = "&lt;div id='id' class="class"&gt;/&lt;/div&gt;";

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, null) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, 5) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, '5') === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, true) === escapedForAllString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : true,
                attr : true
            }) === escapedForAllString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, false) === originalString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : false
            }) === originalString, "Full HTML escape failed.");

            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
                text : false,
                attr : true
            }) === escapedForAttrString, "Full HTML escape failed.");
            this.assertTrue(ariaUtilsString.escapeForHTML(originalString, {
github ariatemplates / ariatemplates / test / aria / widgets / errorlist / ListErrorTestCase.js View on Github external
var textComparator = function(errorMessage, domElement) {
            var expected = errorMessage.localizedMessage;
            expected = ariaUtilsString.escapeForHTML(expected, errorMessage.escape);

            var actual = getElementHTML(domElement);
            return compareCaseInsensitive(actual, expected);
        };