mirror of https://github.com/zulip/zulip.git
node tests: Simplify i18n.js and avoid jquery leak.
We remove the jquery dependency here and just search for strings in the text. It turns out the test was leaking jquery into message_edit, so now we explicitly stub jquery in message_edit.
This commit is contained in:
parent
e4e0b6d572
commit
3f4301bcec
|
@ -16,17 +16,13 @@ i18n.init({
|
|||
resources: {
|
||||
fr: {
|
||||
translation: {
|
||||
"Quote and reply": "French",
|
||||
"Quote and reply": "French translation",
|
||||
"You'll receive notifications when a message arrives and Zulip isn't in focus or the message is offscreen.": "Some French text with Zulip",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
var jsdom = require("jsdom");
|
||||
var window = jsdom.jsdom().defaultView;
|
||||
global.$ = require('jquery')(window);
|
||||
|
||||
(function test_t_tag() {
|
||||
var args = {
|
||||
message: {
|
||||
|
@ -41,12 +37,8 @@ global.$ = require('jquery')(window);
|
|||
narrowed: true,
|
||||
};
|
||||
|
||||
var html = '<div style="height: 250px">';
|
||||
html += global.render_template('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);
|
||||
var html = global.render_template('actions_popover_content', args);
|
||||
assert(html.indexOf("French translation") > 0);
|
||||
}());
|
||||
|
||||
(function test_tr_tag() {
|
||||
|
@ -71,7 +63,5 @@ global.$ = require('jquery')(window);
|
|||
};
|
||||
|
||||
var html = global.render_template('settings_tab', args);
|
||||
var div = $(html).find("div.notification-reminder");
|
||||
assert.equal(div.text().trim(), 'Some French text with Zulip');
|
||||
global.write_test_output("test_tr_tag settings", html);
|
||||
assert(html.indexOf('Some French text with Zulip') > 0);
|
||||
}());
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
set_global('document', null);
|
||||
set_global('page_params', {});
|
||||
|
||||
global.stub_out_jquery();
|
||||
|
||||
add_dependencies({
|
||||
XDate: 'node_modules/xdate/src/xdate.js',
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue