Skip to content

Commit

Permalink
Add binding (.i18n()) test with nested options.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugojosefson committed May 9, 2012
1 parent 0294b29 commit be752be
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test.js
Expand Up @@ -418,6 +418,28 @@ asyncTest("basic binding (.i18n()) test with options", function() {
});
});

asyncTest("binding (.i18n()) test with nested options", function() {
$.i18n.init({
lng: 'en-US',
lowerCaseLng: false,
ns: 'translation',
useLocalStorage: false,
resStore: {
'en-US': { translation: { 'simpleTest': '__rootoption.first__ and then __rootoption.second__' } }
}
}, function(t) {
// given
$('#qunit-fixture').append('<button id="testBtn" data-i18n="simpleTest"></button>');

// when
$('#qunit-fixture').i18n({"rootoption":{"first":"ok_first_nested", "second":"ok_second_nested"}});

// then
equals($('#testBtn').text(),'ok_first_nested and then ok_second_nested', 'set text via fn .i18n(nested.options)');
start();
});
});

asyncTest("switching lng", function() {
$.i18n.init({
lng: 'en-US',
Expand Down

0 comments on commit be752be

Please sign in to comment.