Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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"', [
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");
}
}
},
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
])
);
}
}
},
}, function (shouldBeTrue) {
return ariaUtilsString.substitute('Dialog with id "%1" should%2be maximized.', [
dialog.id,
shouldBeTrue ? ' ' : ' not '
]);
});
}, 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]);
});
},
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");
}
}
},