2016-05-13 12:44:03 +02:00
add _dependencies ( {
Handlebars : 'handlebars' ,
templates : 'js/templates' ,
i18n : 'i18next'
} ) ;
var i18n = global . i18n ;
i18n . init ( {
nsSeparator : false ,
keySeparator : false ,
interpolation : {
prefix : "__" ,
suffix : "__"
} ,
lng : 'fr' ,
resources : {
fr : {
translation : {
'Reply' : "French" ,
"You'll receive notifications when a message arrives and __page_params.product_name__ isn't in focus or the message is offscreen." : "Some French text with __page_params.product_name__"
}
}
}
} ) ;
2016-07-28 20:30:21 +02:00
global . $ = require ( 'jQuery' ) ;
2016-05-13 12:44:03 +02:00
var _ = global . _ ;
// When writing these tests, the following command might be helpful:
// ./tools/get-handlebar-vars static/templates/*.handlebars
function render ( template _name , args ) {
global . use _template ( template _name ) ;
return global . templates . render ( template _name , args ) ;
}
( function test _t _tag ( ) {
var args = {
"message" : {
is _stream : true ,
id : "99" ,
stream : "devel" ,
subject : "testing" ,
sender _full _name : "King Lear"
} ,
"can_edit_message" : true ,
"can_mute_topic" : true ,
"narrowed" : true
} ;
var html = '<div style="height: 250px">' ;
html += render ( 'actions_popover_content' , args ) ;
html += "</div>" ;
var link = $ ( html ) . find ( "a.respond_button" ) ;
assert . equal ( link . text ( ) . trim ( ) , 'French' ) ;
global . write _test _output ( "actions_popover_content.handlebars" , html ) ;
} ( ) ) ;
( function test _tr _tag ( ) {
var args = {
"page_params" : {
"fullname" : "John Doe" ,
"product_name" : "Zulip" ,
"password_auth_enabled" : false ,
"avatar_url" : "http://example.com" ,
"left_side_userlist" : false ,
"twenty_four_hour_time" : false ,
"stream_desktop_notifications_enabled" : false ,
"stream_sounds_enabled" : false ,
"desktop_notifications_enabled" : false ,
"sounds_enabled" : false ,
"enable_offline_email_notifications" : false ,
"enable_offline_push_notifications" : false ,
"enable_digest_emails" : false ,
"domain" : "zulip.com" ,
"autoscroll_forever" : false ,
"default_desktop_notifications" : false
}
} ;
2016-07-30 06:18:55 +02:00
var html = render ( 'settings_tab' , args ) ;
2016-05-13 12:44:03 +02:00
var div = $ ( html ) . find ( "div.notification-reminder" ) ;
assert . equal ( div . text ( ) . trim ( ) , 'Some French text with Zulip' ) ;
2016-07-30 06:18:55 +02:00
global . write _test _output ( "test_tr_tag settings" , html ) ;
2016-05-13 12:44:03 +02:00
} ( ) ) ;