From 7485cb2a502862a2665c81bd3f2f52439b1b3657 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 16 Dec 2018 19:46:27 -0800 Subject: [PATCH] widgets: Rename voting_widget to poll_widget. This ensures greater consistency with our other widgets' naming convention. --- .eslintrc.json | 2 +- docs/subsystems/widgets.md | 6 +++--- frontend_tests/node_tests/voting_widget.js | 8 ++++---- frontend_tests/node_tests/widgetize.js | 4 ++-- static/js/bundles/app.js | 2 +- static/js/{voting_widget.js => poll_widget.js} | 6 +++--- static/js/widgetize.js | 2 +- tools/test-js-with-node | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) rename static/js/{voting_widget.js => poll_widget.js} (98%) diff --git a/.eslintrc.json b/.eslintrc.json index aa69543962..7751ed177f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -198,7 +198,7 @@ "user_pill": false, "user_search": false, "util": false, - "voting_widget": false, + "poll_widget": false, "widgetize": false, "zcommand": false, "zform": false, diff --git a/docs/subsystems/widgets.md b/docs/subsystems/widgets.md index 52b2a93f31..4ea61a8e8e 100644 --- a/docs/subsystems/widgets.md +++ b/docs/subsystems/widgets.md @@ -41,7 +41,7 @@ features: - `static/js/zform.js` - `static/js/zcommand.js` - `static/js/submessage.js` -- `static/js/voting_widget.js` +- `static/js/poll_widget.js` - `static/js/widgetize.js` - `static/js/zform.js` - `static/templates/widgets/` @@ -178,7 +178,7 @@ jQuery and template.render, and the developer can create new templates in `static/templates/widgets/`. A good way to learn the system is to read the code -in `static/js/voting_widget.js`. It is worth noting that +in `static/js/poll_widget.js`. It is worth noting that writing a new widget requires only minor backend changes in the current architecture. This could change in the future, but for now a frontend developer mostly @@ -376,7 +376,7 @@ just has a somewhat more generic job to do.) In converges, with snippets like this: ~~~ js -widgets.poll = voting_widget; +widgets.poll = poll_widget; widgets.tictactoe = tictactoe_widget; widgets.todo = todo_widget; widgets.zform = zform; diff --git a/frontend_tests/node_tests/voting_widget.js b/frontend_tests/node_tests/voting_widget.js index a63a8ee2ce..42e5342394 100644 --- a/frontend_tests/node_tests/voting_widget.js +++ b/frontend_tests/node_tests/voting_widget.js @@ -1,4 +1,4 @@ -zrequire('voting_widget'); +zrequire('poll_widget'); set_global('$', global.make_zjquery()); set_global('i18n', global.stub_i18n); @@ -18,7 +18,7 @@ run_test('poll_data_holder my question', () => { const sender_id = 99; people.my_current_user_id = () => sender_id; - const data_holder = voting_widget.poll_data_holder(is_my_poll, question); + const data_holder = poll_widget.poll_data_holder(is_my_poll, question); let data = data_holder.get_widget_data(); @@ -198,7 +198,7 @@ run_test('activate another person poll', () => { vote_button_callback = func; }; - voting_widget.activate(opts); + poll_widget.activate(opts); assert.equal(widget_elem.html(), 'poll-widget'); assert.equal(widget_comment_container.html(), 'poll-widget-results'); @@ -347,7 +347,7 @@ run_test('activate own poll', () => { // Setting visiblity to true as default is false poll_question_container.show(); - voting_widget.activate(opts); + poll_widget.activate(opts); assert.equal(widget_elem.html(), 'poll-widget'); assert.equal(widget_comment_container.html(), 'poll-widget-results'); diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js index a6072cbf66..bd1b2a06dd 100644 --- a/frontend_tests/node_tests/widgetize.js +++ b/frontend_tests/node_tests/widgetize.js @@ -1,5 +1,5 @@ set_global('$', global.make_zjquery()); -set_global('voting_widget', {}); +set_global('poll_widget', {}); set_global('tictactoe_widget', {}); set_global('todo_widget', {}); set_global('zform', {}); @@ -74,7 +74,7 @@ run_test('activate', () => { let is_widget_activated; let is_widget_elem_inserted; - voting_widget.activate = (data) => { + poll_widget.activate = (data) => { is_widget_activated = true; widget_elem = data.elem; assert(widget_elem.hasClass('widget-content')); diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index 62a4760b0a..38a7eb08a2 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -67,7 +67,7 @@ import "js/top_left_corner.js"; import "js/stream_list.js"; import "js/topic_zoom.js"; import "js/filter.js"; -import 'js/voting_widget.js'; +import 'js/poll_widget.js'; import 'js/todo_widget.js'; import 'js/tictactoe_widget.js'; import 'js/zform.js'; diff --git a/static/js/voting_widget.js b/static/js/poll_widget.js similarity index 98% rename from static/js/voting_widget.js rename to static/js/poll_widget.js index 783db8ae43..9226c4ad54 100644 --- a/static/js/voting_widget.js +++ b/static/js/poll_widget.js @@ -1,4 +1,4 @@ -var voting_widget = (function () { +var poll_widget = (function () { var exports = {}; @@ -231,7 +231,7 @@ return exports; }()); if (typeof module !== 'undefined') { - module.exports = voting_widget; + module.exports = poll_widget; } -window.voting_widget = voting_widget; +window.poll_widget = poll_widget; diff --git a/static/js/widgetize.js b/static/js/widgetize.js index fcb0cde6d3..25a4fa3466 100644 --- a/static/js/widgetize.js +++ b/static/js/widgetize.js @@ -4,7 +4,7 @@ var exports = {}; var widgets = {}; -widgets.poll = voting_widget; +widgets.poll = poll_widget; widgets.tictactoe = tictactoe_widget; widgets.todo = todo_widget; widgets.zform = zform; diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 4219341cfc..f68f71e7f9 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -85,7 +85,7 @@ enforce_fully_covered = { 'static/js/user_search.js', 'static/js/util.js', 'static/js/widgetize.js', - 'static/js/voting_widget.js', + 'static/js/poll_widget.js', 'static/js/search_pill.js', }