siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
39 lines (29 loc) • 887 B
JavaScript
/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
Class('Siesta.Test.BDD.StringPlaceholder', {
does : [
Siesta.Util.Role.CanGetType,
Siesta.Test.Role.Placeholder
],
has : {
value : { required : true }
},
methods : {
equalsTo : function (string) {
if (this.typeOf(this.value) == 'RegExp')
return this.value.test(string)
else
return String(string).indexOf(this.value) > -1
},
toString : function () {
if (this.typeOf(this.value) == 'RegExp')
return 'any string matching: ' + this.value
else
return 'any string containing: ' + this.value
}
}
})