Sha256: 8f5848fa8e6dd170acc8b53216a6006768ab4ba1301194cab11abb6979218d28
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' describe 'I18n client methods', js: true do before(:each) do on_client do class MyModel < ActiveRecord::Base end module Components class TestComponent include Hyperstack::Component include Hyperstack::I18n render(DIV) do DIV(id: :tp1) { t(:the_key) } DIV(id: :tp2) { I18n.t(:hello) } DIV(id: :tp3) { l(Time.parse('1/1/2018 12:45')) } DIV(id: :tp4) { l(Time.parse('1/1/2018 12:45'), '%B %d, %Y at %l:%M %P') } DIV(id: :tp5) { MyModel.model_name.human } DIV(id: :tp6) { MyModel.human_attribute_name('the_attribute') } end end end end end [['component rendering', :client_only], ['prerendering', :server_only]].each do |mode, flag| it "will translate during #{mode}" do mount 'Components::TestComponent', {}, render_on: flag expect(find('#tp1')).to have_content('I am a key') expect(find('#tp2')).to have_content('Hello world') expect(find('#tp3')).to have_content(::I18n.l(Time.parse('1/1/2018 12:45'))) expect(find('#tp4')).to have_content(::I18n.l(Time.parse('1/1/2018 12:45'), format: '%B %d, %Y at %l:%M %P')) expect(find('#tp5')).to have_content('My Model') expect(find('#tp6')).to have_content('The Attribute') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper-i18n-1.0.alpha1.5 | spec/hyper_i18n_spec.rb |