emoji.js: Add test coverage for build_emoji_upload_widget func.

This commit is contained in:
Aditya Bansal 2017-06-25 19:11:01 +05:30 committed by showell
parent d1fe75ce3b
commit 88d9739c45
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
set_global('$', global.make_zjquery());
set_global('page_params', {});
set_global('upload_widget', {});
add_dependencies({
emoji_codes: 'generated/emoji/emoji_codes.js',
});
var emoji = require('js/emoji.js');
(function test_build_emoji_upload_widget() {
var build_widget_stub = false;
upload_widget.build_widget = function (
get_file_input,
file_name_field,
input_error,
clear_button,
upload_button
) {
assert.deepEqual(get_file_input(), $('#emoji_file_input'));
assert.deepEqual(file_name_field, $('#emoji-file-name'));
assert.deepEqual(input_error, $('#emoji_file_input_error'));
assert.deepEqual(clear_button, $('#emoji_image_clear_button'));
assert.deepEqual(upload_button, $('#emoji_upload_button'));
build_widget_stub = true;
};
emoji.build_emoji_upload_widget();
assert(build_widget_stub);
}());