translation-tests.js 633 B

12345678910111213141516171819202122232425262728
  1. module('Options - Translations');
  2. var $ = require('jquery');
  3. var Options = require('select2/options');
  4. test('partial dictionaries can be passed', function (assert) {
  5. var options = new Options({
  6. language: {
  7. searching: function () {
  8. return 'Something';
  9. }
  10. }
  11. });
  12. var translations = options.get('translations');
  13. assert.equal(
  14. translations.get('searching')(),
  15. 'Something',
  16. 'The partial dictionary still overrides translations'
  17. );
  18. assert.equal(
  19. translations.get('noResults')(),
  20. 'No results found',
  21. 'You can still get English translations for keys not passed in'
  22. );
  23. });