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:
crschmidt
2009-02-27 00:44:20 +00:00
parent f04f203499
commit b625e9f12f
2 changed files with 61 additions and 17 deletions

View File

@@ -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) {