How to use the ariatemplates/utils/String.substitute 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 / widgets / wai / popup / dialog / modal / Base.js View on Github external
var dialogInstance = this.getWidgetInstance(id);
                var dialogContainer = dialogInstance._popup.domElement;

                var labelId = dialogContainer.getAttribute(attributeName);

                if (!wai) {
                    this.assertTrue(
                        labelId == null,
                        'Dialog should not have a label.'
                    );
                } else {
                    var labelElement = ariaUtilsDom.getElementById(labelId);

                    this.assertTrue(
                        labelElement != null,
                        ariaUtilsString.substitute(
                            'Label element should exist, id: %1', [
                            labelId
                        ])
                    );

                    var actual = labelElement.textContent;
                    if (actual == null) {
                        actual = labelElement.innerText;
                    }

                    var expected = title;

                    this.assertTrue(
                        actual === expected,
                        ariaUtilsString.substitute(
                            'Label content is not the expected one: "%1" instead of "%2"', [
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testSubstituteString : function () {
            var holders = {
                "% 1" : "% 1",
                "%1" : "thisString",
                "%1aaa" : "thisStringaaa",
                "a%1aa" : "athisStringaa",
                "aaa%1" : "aaathisString",
                "%1111" : "thisString1111"
            }, got;

            var epxected = [];
            for (var key in holders) {
                if (holders.hasOwnProperty(key)) {
                    got = ariaUtilsString.substitute(holders[key], "thisString");

                    this.assertEquals(got, holders[key], "Expecting %2, got %1");
                }
            }
        },
github ariatemplates / ariatemplates / test / aria / widgets / wai / popup / dialog / modal / Base.js View on Github external
ariaUtilsString.substitute(
                            'Label element should exist, id: %1', [
                            labelId
                        ])
                    );

                    var actual = labelElement.textContent;
                    if (actual == null) {
                        actual = labelElement.innerText;
                    }

                    var expected = title;

                    this.assertTrue(
                        actual === expected,
                        ariaUtilsString.substitute(
                            'Label content is not the expected one: "%1" instead of "%2"', [
                            actual,
                            expected
                        ])
                    );
                }
            }
        },
github ariatemplates / ariatemplates / test / aria / widgets / wai / popup / dialog / modal / Base.js View on Github external
}, function (shouldBeTrue) {
                return ariaUtilsString.substitute('Dialog with id "%1" should%2be maximized.', [
                    dialog.id,
                    shouldBeTrue ? ' ' : ' not '
                ]);
            });
github ariatemplates / ariatemplates / test / aria / widgets / wai / tabs / Base.js View on Github external
}, function (shouldBeTrue, args) {
                var selectedTab = this._readBinding(group.binding);

                var message;
                if (id == null) {
                    message = 'No tab should be selected, instead "%1" is.';
                } else {
                    message = 'The wrong tab is selected: "%1" instead of "%2".';
                }

                return ariaUtilsString.substitute(message, [selectedTab, id]);
            });
        },
github ariatemplates / ariatemplates / test / aria / utils / StringTestCase.js View on Github external
testSubstituteArrayOfOne : function () {
            var holders = {
                "% 1" : "% 1",
                "%1" : "thisString",
                "%1aaa" : "thisStringaaa",
                "a%1aa" : "athisStringaa",
                "aaa%1" : "aaathisString",
                "%1111" : "thisString1111"
            }, got;

            var epxected = [];
            for (var key in holders) {
                if (holders.hasOwnProperty(key)) {
                    got = ariaUtilsString.substitute(holders[key], ["thisString", "another"]);

                    this.assertEquals(got, holders[key], "Expecting %2, got %1");
                }
            }
        },