Sha256: ba4d99e425a2dabee7893a7628616aa97d84e270766657232a58754c14b00dc6
Contents?: true
Size: 1.99 KB
Versions: 2
Compression:
Stored size: 1.99 KB
Contents
#= require ultimate/jquery-plugin-class module "Ultimate.Plugin" class EmptyPlugin extends Ultimate.Plugin test "EmptyPlugin", -> cout 'EmptyPlugin' $('#qunit-fixture').html '<div class="test-plugin"><div class="test-plugin__inner"></div></div>' plugin = new EmptyPlugin(el: '.test-plugin') ok /^ultimatePlugin_\d+$/.test(plugin.cid) ok plugin.$el.length is 1 jDiv = plugin.$('div') ok jDiv.length is 1 ok jDiv.hasClass('test-plugin__inner') strictEqual plugin.locale, 'en' strictEqual plugin.t('smokeString'), 'Smoke string' class TestPlugin extends Ultimate.Plugin someOption: null @defaultLocales = en: someMessage: 'English message.' ru: someMessage: 'Сообщение на русском.' test "TestPlugin", -> cout 'warn', 'TestPlugin' $('#qunit-fixture').html '<div class="test-plugin"><a class="action one" href="javascript:;">action one</a><div class="test-plugin__inner"></div></div>' plugin = new TestPlugin el: '.test-plugin' someOption: 'bingo!' otherOption: 'ringo!' locale: 'de' equal plugin.someOption, 'bingo!' ok typeof plugin.otherOption is 'undefined' equal plugin.locale, 'de' deepEqual plugin.translations, {} # equal plugin.t('someMessage'), 'Some message' # plugin._configure locale: 'ru' # deepEqual plugin.translations, {someMessage: 'Сообщение на русском.'} # equal plugin.t('someMessage'), 'Сообщение на русском.' #test "TestPlugin locale from I18n", -> # cout 'warn', 'TestPlugin locale from I18n' # window.I18n ||= {} # _storedI18nLocale = I18n.locale # cout '_storeI18nLocale', _storedI18nLocale # I18n.locale = 'de' # plugin = new TestPlugin el: '.test-plugin' # strictEqual plugin.locale, 'en' # equal plugin.t('someMessage'), 'English message.' ## I18n.locale = 'ru' ## plugin = new TestPlugin el: '.test-plugin' ## strictEqual plugin.locale, 'ru' ## equal plugin.t('someMessage'), 'Сообщение на русском.' # I18n.locale = _storedI18nLocale
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ultimate-base-0.7.2 | test/javascripts/tests/jquery-plugin-class_test.js.coffee |
ultimate-base-0.6.2 | test/javascripts/tests/jquery-plugin-class_test.js.coffee |