mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Merge branch 'master' of github.com:openseadragon/openseadragon
Fixed Conflicts: test/test.html
This commit is contained in:
commit
199c2f6c2d
@ -37,12 +37,14 @@ $.extend( $, {
|
|||||||
var props = prop.split('.'),
|
var props = prop.split('.'),
|
||||||
string = null,
|
string = null,
|
||||||
args = arguments,
|
args = arguments,
|
||||||
|
container = I18N,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
for ( i = 0; i < props.length; i++ ) {
|
for ( i = 0; i < props.length-1; i++ ) {
|
||||||
// in case not a subproperty
|
// in case not a subproperty
|
||||||
string = I18N[ props[ i ] ] || {};
|
container = container[ props[ i ] ] || {};
|
||||||
}
|
}
|
||||||
|
string = container[ props[ i ] ];
|
||||||
|
|
||||||
if ( typeof( string ) != "string" ) {
|
if ( typeof( string ) != "string" ) {
|
||||||
string = "";
|
string = "";
|
||||||
@ -65,7 +67,7 @@ $.extend( $, {
|
|||||||
setString: function( prop, value ) {
|
setString: function( prop, value ) {
|
||||||
|
|
||||||
var props = prop.split('.'),
|
var props = prop.split('.'),
|
||||||
container = $.Strings,
|
container = I18N,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
for ( i = 0; i < props.length - 1; i++ ) {
|
for ( i = 0; i < props.length - 1; i++ ) {
|
||||||
|
29
test/strings.js
Normal file
29
test/strings.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
(function() {
|
||||||
|
|
||||||
|
module("strings");
|
||||||
|
test("getSubString", function() {
|
||||||
|
equal(OpenSeadragon.getString("Errors.Dzi"),
|
||||||
|
"Hmm, this doesn't appear to be a valid Deep Zoom Image.",
|
||||||
|
"Read sub-string");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getInvalidString", function() {
|
||||||
|
equal(OpenSeadragon.getString("Greeting"), "",
|
||||||
|
"Handled unset string key");
|
||||||
|
equal(OpenSeadragon.getString("Errors"), "",
|
||||||
|
"Handled requesting parent key");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("setString", function() {
|
||||||
|
OpenSeadragon.setString("Greeting", "Hello world");
|
||||||
|
equal(OpenSeadragon.getString("Greeting"), "Hello world",
|
||||||
|
"Set a string");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("setSubString", function() {
|
||||||
|
OpenSeadragon.setString("CustomGreeting.Hello", "Hello world");
|
||||||
|
equal(OpenSeadragon.getString("CustomGreeting.Hello"), "Hello world",
|
||||||
|
"Set a sub-string");
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -16,6 +16,7 @@
|
|||||||
<script src="/build/openseadragon/openseadragon.min.js"></script>
|
<script src="/build/openseadragon/openseadragon.min.js"></script>
|
||||||
<script src="/test/util.js"></script>
|
<script src="/test/util.js"></script>
|
||||||
<script src="/test/basic.js"></script>
|
<script src="/test/basic.js"></script>
|
||||||
|
<script src="/test/strings.js"></script>
|
||||||
<script src="/test/dzi-jsonp.js"></script>
|
<script src="/test/dzi-jsonp.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user