Fix for "BaseTypes.String.Format does not support sub-elements", patch + tests
from rdewit, r=me, (Closes #1956) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8900 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
"", "${ ", "${", " ${", "${${", "${}", "${${}}", " ${ ${",
|
||||
"}", "${${} }"
|
||||
]
|
||||
t.plan(6 + unchanged.length);
|
||||
t.plan(7 + unchanged.length);
|
||||
|
||||
var format = OpenLayers.String.format;
|
||||
|
||||
@@ -140,6 +140,23 @@
|
||||
"still works if arguments are not supplied"
|
||||
);
|
||||
|
||||
// test contexts where attribute values can be objects
|
||||
var context = {
|
||||
a: {
|
||||
b: {
|
||||
c: 'd',
|
||||
e: function() {
|
||||
return 'f';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
t.eq(
|
||||
format("${a.b.c} ${a.b.e} ${a.b.q} ${a} ${a...b...c}", context),
|
||||
"d f undefined [object Object] d",
|
||||
"attribute values that are objects are supported"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function test_String_isNumeric(t) {
|
||||
|
||||
Reference in New Issue
Block a user